Package co.elastic.apm.agent.impl
Interface Scope
-
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Implementing Classes:
Scope.NoopScope
public interface Scope extends java.lang.AutoCloseableWithin a scope, aAbstractSpanis active on the current thread. Callingclose()detaches them from the active thread. In a scope, you can get the currently activeAbstractSpanviaElasticApmTracer.getActive().During the duration of a
AbstractSpan, it can be active multiple times on multiple threads. In applications with a single thread per request model, there is typically one scope which lasts for the lifetime of theAbstractSpan. In reactive applications, this model does not work, as a request is handled in multiple threads. These types of application still might find it useful to scope aAbstractSpanon the currently processing thread. For example, an instrumentation forExecutorServicemight want to propagate the currently activeAbstractSpanto thread which runsExecutor.execute(Runnable), so thatElasticApmTracer.getActive()returns the expectedAbstractSpan.Note:
closinga scope does notendit's activeAbstractSpan.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classScope.NoopScope
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()
-