with New Scope
Instruments a function f with a new scope. This is helpful if you need to create a new Scope for an existing Span, for example, if you are switching threads (since Scopes are not thread-safe).
tracer.traceWithSpan("thread-switching-span") {
...
thread {
tracer.withNewScope(span) { ... }
}
}Content copied to clipboard