|
1 | 1 | package datadog.trace.core.scopemanager; |
2 | 2 |
|
3 | 3 | import static datadog.trace.api.ConfigDefaults.DEFAULT_ASYNC_PROPAGATING; |
4 | | -import static datadog.trace.api.telemetry.LogCollector.SEND_TELEMETRY; |
5 | 4 | import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.noopScope; |
6 | 5 | import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.noopSpan; |
7 | 6 | import static datadog.trace.core.scopemanager.ContinuableScope.CONTEXT; |
@@ -239,25 +238,24 @@ public void closePrevious(final boolean finishSpan) { |
239 | 238 |
|
240 | 239 | // close any immediately previous iteration scope |
241 | 240 | final ContinuableScope top = scopeStack.top; |
242 | | - if (top != null) { |
243 | | - if (top.source() == ITERATION) { |
244 | | - if (iterationKeepAlive > 0) { // skip depth check because cancelling is cheap |
245 | | - cancelRootIterationScopeCleanup(scopeStack, top); |
246 | | - } |
247 | | - top.close(); |
248 | | - scopeStack.cleanup(); |
249 | | - AgentSpan span = top.span(); |
250 | | - if (finishSpan && span != null) { |
251 | | - span.finishWithEndToEnd(); |
252 | | - } |
253 | | - } else { |
254 | | - log.debug( |
255 | | - SEND_TELEMETRY, |
256 | | - "Scope found at top of stack has source {} when we expect {}. Current span at the top of the stack {}.", |
257 | | - top, |
258 | | - ITERATION, |
259 | | - top.span()); |
| 241 | + if (top != null && top.source() == ITERATION) { |
| 242 | + if (iterationKeepAlive > 0) { // skip depth check because cancelling is cheap |
| 243 | + cancelRootIterationScopeCleanup(scopeStack, top); |
| 244 | + } |
| 245 | + top.close(); |
| 246 | + scopeStack.cleanup(); |
| 247 | + AgentSpan span = top.span(); |
| 248 | + if (finishSpan && span != null) { |
| 249 | + span.finishWithEndToEnd(); |
260 | 250 | } |
| 251 | + } else if (top != null) { |
| 252 | + // log.debug( |
| 253 | + // SEND_TELEMETRY, |
| 254 | + // "Scope found at top of stack has source {} when we expect {}. Current span at the top |
| 255 | + // of the stack {}.", |
| 256 | + // top, |
| 257 | + // ITERATION, |
| 258 | + // top.span()); |
261 | 259 | } |
262 | 260 | } |
263 | 261 |
|
|
0 commit comments