未验证 提交 3e0da01c 编写于 作者: wu-sheng's avatar wu-sheng 提交者: GitHub

Merge branch 'master' into feature/alarm

......@@ -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) {
......
......@@ -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;
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册