Package io.quarkus.opentelemetry.runtime
Enum Class QuarkusContextStorage
- All Implemented Interfaces:
io.opentelemetry.context.ContextStorage,Serializable,Comparable<QuarkusContextStorage>,Constable
public enum QuarkusContextStorage
extends Enum<QuarkusContextStorage>
implements io.opentelemetry.context.ContextStorage
Bridges the OpenTelemetry ContextStorage with the Vert.x Context. The default OpenTelemetry ContextStorage (based in
ThreadLocals) is not suitable for Vert.x. In this case, the OpenTelemetry Context piggybacks on top of the Vert.x
Context. If the Vert.x Context is not available, fallbacks to an MDC enabled context storage that wraps the default
OpenTelemetry ContextStorage.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionio.opentelemetry.context.Scopeattach(io.opentelemetry.context.Context toAttach) Attach the OpenTelemetry Context to the current Context.io.opentelemetry.context.Scopeattach(io.vertx.core.Context vertxContext, io.opentelemetry.context.Context toAttach) Attach the OpenTelemetry Context in the Vert.x Context if it is a duplicated Vert.x Context.io.opentelemetry.context.Contextcurrent()Gets the current OpenTelemetry Context from the current Vert.x Context if one exists or from the default ContextStorage.static io.opentelemetry.context.ContextgetContext(io.vertx.core.Context vertxContext) Gets the OpenTelemetry Context in a Vert.x Context.static io.vertx.core.ContextGets the current duplicated context or a new duplicated context if a Vert.x Context exists.static QuarkusContextStorageReturns the enum constant of this class with the specified name.static QuarkusContextStorage[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOfMethods inherited from interface io.opentelemetry.context.ContextStorage
root
-
Enum Constant Details
-
INSTANCE
-
-
Field Details
-
vertx
static io.vertx.core.Vertx vertx
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
attach
public io.opentelemetry.context.Scope attach(io.opentelemetry.context.Context toAttach) Attach the OpenTelemetry Context to the current Context. If a Vert.x Context is available, and it is a duplicated Vert.x Context the OpenTelemetry Context is attached to the Vert.x Context. Otherwise, fallback to the OpenTelemetry default ContextStorage.- Specified by:
attachin interfaceio.opentelemetry.context.ContextStorage- Parameters:
toAttach- the OpenTelemetry Context to attach- Returns:
- the Scope of the OpenTelemetry Context
-
attach
public io.opentelemetry.context.Scope attach(io.vertx.core.Context vertxContext, io.opentelemetry.context.Context toAttach) Attach the OpenTelemetry Context in the Vert.x Context if it is a duplicated Vert.x Context.- Parameters:
vertxContext- the Vert.x Context to attach the OpenTelemetry ContexttoAttach- the OpenTelemetry Context to attach- Returns:
- the Scope of the OpenTelemetry Context
-
current
public io.opentelemetry.context.Context current()Gets the current OpenTelemetry Context from the current Vert.x Context if one exists or from the default ContextStorage. The current Vert.x Context must be a duplicated Context.- Specified by:
currentin interfaceio.opentelemetry.context.ContextStorage- Returns:
- the current OpenTelemetry Context or null.
-
getContext
public static io.opentelemetry.context.Context getContext(io.vertx.core.Context vertxContext) Gets the OpenTelemetry Context in a Vert.x Context. The Vert.x Context has to be a duplicate context.- Parameters:
vertxContext- a Vert.x Context.- Returns:
- the OpenTelemetry Context if exists in the Vert.x Context or null.
-
getVertxContext
public static io.vertx.core.Context getVertxContext()Gets the current duplicated context or a new duplicated context if a Vert.x Context exists. Multiple invocations of this method may return the same or different context. If the current context is a duplicate one, multiple invocations always return the same context. If the current context is not duplicated, a new instance is returned with each method invocation.- Returns:
- a duplicated Vert.x Context or null.
-