ThreadLocalAccessor to put and restore current Span depending on
whether ObservationThreadLocalAccessor did some work or not (if
ObservationThreadLocalAccessor opened a scope, then this class doesn't want to
create yet another span).
In essence logic of this class is as follows:
ObservationThreadLocalAccessor created a Span via the
TracingObservationHandler - do nothingSpan and putting it in thread
localImportant Note
ObservationAwareSpanThreadLocalAccessor must be registered
AFTER the ObservationThreadLocalAccessor. The easiest way to achieve that is to
call ContextRegistry#registerThreadLocalAccessor(ThreadLocalAccessor) manually.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| public static final String | KEY
Key under which Micrometer Tracing is being registered. |
| private static final InternalLogger | |
| private final ObservationRegistry | |
| pack-priv final Map | |
| private final Tracer |
| Access | Constructor and Description |
|---|---|
| public | ObservationAwareSpanThreadLocalAccessor(Tracer
tracer tracer)Creates a new instance of |
| public | ObservationAwareSpanThreadLocalAccessor(ObservationRegistry
observationRegistry observationRegistry, Tracer tracer tracer)Creates a new instance of |
| Modifier and Type | Method and Description |
|---|---|
| public Span | getValue()
Implements io. ThreadLocal value.
|
| public Object | key()
Implements io. ContextSnapshot.
|
| public void | restore(Span
previous value to set, never previousValue)null when called from a
ContextSnapshot * implementation, which is not allowed to store mappings to
null.Overrides default io. ThreadLocal at the end of a
io.
|
| public void | restore()
Overrides default io. restore(Object) when there was no ThreadLocal
value existing at the start of the scope.
|
| public void | setValue(Span
the value to set, never value)null when called from a
ContextSnapshot implementation, which is not allowed to store mappings to
null.Implements io. ThreadLocal at the start of a
io.
|
| public void | setValue()
Overrides default io. setValue(Object) in order to remove the current
ThreadLocal value at the start of a
io.
|
| KEY | back to summary |
|---|---|
| public static final String KEY Key under which Micrometer Tracing is being registered. | |
| log | back to summary |
|---|---|
| private static final InternalLogger log | |
| registry | back to summary |
|---|---|
| private final ObservationRegistry registry | |
| spanActions | back to summary |
|---|---|
| pack-priv final Map<Thread, ObservationAwareSpanThreadLocalAccessor. | |
| tracer | back to summary |
|---|---|
| private final Tracer tracer | |
| ObservationAwareSpanThreadLocalAccessor | back to summary |
|---|---|
| public ObservationAwareSpanThreadLocalAccessor(Tracer tracer) Creates a new instance of
| |
| ObservationAwareSpanThreadLocalAccessor | back to summary |
|---|---|
| public ObservationAwareSpanThreadLocalAccessor(ObservationRegistry observationRegistry, Tracer tracer) Creates a new instance of
| |
| getValue | back to summary |
|---|---|
| public Span getValue() Implements io. Doc from io. Return the current This method is called in two scenarios:
| |
| key | back to summary |
|---|---|
| public Object key() Implements io. Doc from io. The key to associate with the ThreadLocal value when saved within a
| |
| restore | back to summary |
|---|---|
| public void restore(Span previousValue) Overrides default io. Doc from io. Restore the
| |
| restore | back to summary |
|---|---|
| public void restore() Overrides default io. Doc from io. Called instead of
| |
| setValue | back to summary |
|---|---|
| public void setValue(Span value) Implements io. Doc from io. Set the
| |
| setValue | back to summary |
|---|---|
| public void setValue() Overrides default io. Doc from io. Called instead of
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final ObservationAwareSpanThreadLocalAccessor. | |
| pack-priv AutoCloseable | |
| pack-priv final Map |
| Access | Constructor and Description |
|---|---|
| pack-priv | SpanAction(Map<Thread, ObservationAwareSpanThreadLocalAccessor.
|
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Implements java. |
| pack-priv void |
| previous | back to summary |
|---|---|
| pack-priv final ObservationAwareSpanThreadLocalAccessor. | |
| scope | back to summary |
|---|---|
| pack-priv AutoCloseable scope | |
| todo | back to summary |
|---|---|
| pack-priv final Map<Thread, ObservationAwareSpanThreadLocalAccessor. | |
| SpanAction | back to summary |
|---|---|
| pack-priv SpanAction(Map<Thread, ObservationAwareSpanThreadLocalAccessor. | |
| close | back to summary |
|---|---|
| public void close() Implements java. Doc from java. Closes this resource, relinquishing any underlying resources.
This method is invoked automatically on objects managed by the
| |
| setScope | back to summary |
|---|---|
| pack-priv void setScope(Closeable scope) | |