提交 6f986cc7 编写于 作者: P peng-yongsheng

Merge branch 'feature/alarm' of...

Merge branch 'feature/alarm' of https://github.com/peng-yongsheng/incubator-skywalking into feature/alarm
...@@ -21,10 +21,7 @@ package org.apache.skywalking.apm.util; ...@@ -21,10 +21,7 @@ package org.apache.skywalking.apm.util;
public final class StringUtil { public final class StringUtil {
public static boolean isEmpty(String str) { public static boolean isEmpty(String str) {
if (str == null || "".equals(str) || str.length() == 0) { return str == null || str.length() == 0;
return true;
}
return false;
} }
public static String join(final char delimiter, final String... strings) { public static String join(final char delimiter, final String... strings) {
......
...@@ -35,6 +35,8 @@ import org.apache.skywalking.apm.agent.core.context.trace.WithPeerInfo; ...@@ -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.DictionaryManager;
import org.apache.skywalking.apm.agent.core.dictionary.DictionaryUtil; 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.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; import org.apache.skywalking.apm.agent.core.sampling.SamplingService;
/** /**
...@@ -52,6 +54,9 @@ 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 * @author zhang xin
*/ */
public class TracingContext implements AbstractTracerContext { public class TracingContext implements AbstractTracerContext {
private static final ILog logger = LogManager.getLogger(TracingContext.class);
private long lastWarningTimestamp = 0;
/** /**
* @see {@link SamplingService} * @see {@link SamplingService}
*/ */
...@@ -506,6 +511,16 @@ public class TracingContext implements AbstractTracerContext { ...@@ -506,6 +511,16 @@ public class TracingContext implements AbstractTracerContext {
} }
private boolean isLimitMechanismWorking() { 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.
先完成此消息的编辑!
想要评论请 注册