Skip to content

Commit

Permalink
Reuses OTel and Brave's "null scopes"
Browse files Browse the repository at this point in the history
without this change we're trying to clear thread locals and scopes by iterating over all scopes

with this change we always add a scope (either from a span or a null-span scope if there's no span). That way we don't mess up the scope hierarchy
  • Loading branch information
marcingrzejszczak committed May 11, 2023
1 parent a73e919 commit b133055
Show file tree
Hide file tree
Showing 14 changed files with 37 additions and 540 deletions.
2 changes: 1 addition & 1 deletion micrometer-tracing-bom/gradle.lockfile

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package io.micrometer.tracing.brave.bridge;

import brave.propagation.ThreadLocalCurrentTraceContext;
import io.micrometer.tracing.CurrentTraceContext;
import io.micrometer.tracing.TraceContext;

Expand Down Expand Up @@ -76,10 +75,6 @@ public Scope newScope(TraceContext context) {

@Override
public Scope maybeScope(TraceContext context) {
if (context == null && delegate instanceof ThreadLocalCurrentTraceContext) {
((ThreadLocalCurrentTraceContext) delegate).clear();
return Scope.NOOP;
}
return new BraveScope(
this.delegate.maybeScope(io.micrometer.tracing.brave.bridge.BraveTraceContext.toBrave(context)));
}
Expand Down
Loading

0 comments on commit b133055

Please sign in to comment.