Merge branch 'master' into feature/alarm

This commit is contained in:
吴晟 Wu Sheng 2018-01-04 11:44:02 +08:00 committed by GitHub
commit 3e0da01cee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 5 deletions

View File

@ -21,10 +21,7 @@ package org.apache.skywalking.apm.util;
public final class StringUtil {
public static boolean isEmpty(String str) {
if (str == null || "".equals(str) || str.length() == 0) {
return true;
}
return false;
return str == null || str.length() == 0;
}
public static String join(final char delimiter, final String... strings) {

View File

@ -35,6 +35,8 @@ import org.apache.skywalking.apm.agent.core.context.trace.WithPeerInfo;
import org.apache.skywalking.apm.agent.core.dictionary.DictionaryManager;
import org.apache.skywalking.apm.agent.core.dictionary.DictionaryUtil;
import org.apache.skywalking.apm.agent.core.dictionary.PossibleFound;
import org.apache.skywalking.apm.agent.core.logging.api.ILog;
import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
import org.apache.skywalking.apm.agent.core.sampling.SamplingService;
/**
@ -52,6 +54,9 @@ import org.apache.skywalking.apm.agent.core.sampling.SamplingService;
* @author zhang xin
*/
public class TracingContext implements AbstractTracerContext {
private static final ILog logger = LogManager.getLogger(TracingContext.class);
private long lastWarningTimestamp = 0;
/**
* @see {@link SamplingService}
*/
@ -506,6 +511,16 @@ public class TracingContext implements AbstractTracerContext {
}
private boolean isLimitMechanismWorking() {
return spanIdGenerator >= Config.Agent.SPAN_LIMIT_PER_SEGMENT;
if (spanIdGenerator >= Config.Agent.SPAN_LIMIT_PER_SEGMENT) {
long currentTimeMillis = System.currentTimeMillis();
if (currentTimeMillis - lastWarningTimestamp > 30 * 1000) {
logger.warn(new RuntimeException("Shadow tracing context. Thread dump"), "More than {} spans required to create",
Config.Agent.SPAN_LIMIT_PER_SEGMENT);
lastWarningTimestamp = currentTimeMillis;
}
return true;
} else {
return false;
}
}
}