|
33 | 33 | import org.apache.skywalking.apm.agent.core.remote.GRPCChannelManager; |
34 | 34 | import org.apache.skywalking.apm.agent.core.remote.GRPCChannelStatus; |
35 | 35 | import org.apache.skywalking.apm.agent.core.sampling.SamplingService; |
| 36 | +import org.apache.skywalking.apm.agent.core.so11y.AgentSo11y; |
36 | 37 | import org.apache.skywalking.apm.util.StringUtil; |
37 | 38 |
|
38 | 39 | @DefaultImplementor |
@@ -81,17 +82,22 @@ public AbstractTracerContext createTraceContext(String operationName, boolean fo |
81 | 82 | * Don't trace anything if the backend is not available. |
82 | 83 | */ |
83 | 84 | if (!Config.Agent.KEEP_TRACING && GRPCChannelStatus.DISCONNECT.equals(status)) { |
| 85 | + AgentSo11y.measureTracingContextCreation(forceSampling, true); |
84 | 86 | return new IgnoredTracerContext(); |
85 | 87 | } |
86 | 88 |
|
87 | 89 | int suffixIdx = operationName.lastIndexOf("."); |
88 | 90 | if (suffixIdx > -1 && ignoreSuffixSet.contains(operationName.substring(suffixIdx))) { |
| 91 | + AgentSo11y.measureTracingContextCreation(forceSampling, true); |
89 | 92 | context = new IgnoredTracerContext(); |
90 | 93 | } else { |
91 | 94 | SamplingService samplingService = ServiceManager.INSTANCE.findService(SamplingService.class); |
92 | 95 | if (forceSampling || samplingService.trySampling(operationName)) { |
| 96 | + AgentSo11y.measureTracingContextCreation(forceSampling, false); |
93 | 97 | context = new TracingContext(operationName, spanLimitWatcher); |
94 | 98 | } else { |
| 99 | + AgentSo11y.measureTracingContextCreation(false, true); |
| 100 | + AgentSo11y.measureLeakedTracingContext(true); |
95 | 101 | context = new IgnoredTracerContext(); |
96 | 102 | } |
97 | 103 | } |
|
0 commit comments