Top Description Fields Constructors Methods
io.micrometer.tracing

public Class ThreadLocalSpan

extends Object
Class Inheritance
Imports
java.util.ArrayDeque

Represents a Span stored in thread local.
Author
Marcin Grzejszczak
Since
1.0.0

Field Summary

Modifier and TypeField and Description
private final ThreadLocal<ArrayDeque<SpanAndScope>>
private final Tracer

Constructor Summary

AccessConstructor and Description
public
ThreadLocalSpan(Tracer
tracer
tracer
)

Creates a new instance of ThreadLocalSpan.

Method Summary

Modifier and TypeMethod and Description
public SpanAndScope

Returns:

span and scope
get
()

Returns the currently stored span and scope.

private ArrayDeque<SpanAndScope>
public SpanAndScope

Returns:

removed span of null if there was none
remove
()

Removes the current span from thread local and brings back the previous span to the current thread local.

public void
set(Span
- span to be put in scope
span
)

Sets given span and scope.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

currentSpanInScopeStackback to summary
private final ThreadLocal<ArrayDeque<SpanAndScope>> currentSpanInScopeStack
tracerback to summary
private final Tracer tracer

Constructor Detail

ThreadLocalSpanback to summary
public ThreadLocalSpan(Tracer tracer)

Creates a new instance of ThreadLocalSpan.

Parameters
tracer:Tracer

tracer

Method Detail

getback to summary
public SpanAndScope get()

Returns the currently stored span and scope.

Returns:SpanAndScope

span and scope

getCurrentSpanInScopeStackback to summary
private ArrayDeque<SpanAndScope> getCurrentSpanInScopeStack()
removeback to summary
public SpanAndScope remove()

Removes the current span from thread local and brings back the previous span to the current thread local.

Returns:SpanAndScope

removed span of null if there was none

setback to summary
public void set(Span span)

Sets given span and scope.

Parameters
span:Span

- span to be put in scope