Package io.quarkus.opentelemetry.runtime
Enum QuarkusContextStorage
- java.lang.Object
-
- java.lang.Enum<QuarkusContextStorage>
-
- io.quarkus.opentelemetry.runtime.QuarkusContextStorage
-
- All Implemented Interfaces:
io.opentelemetry.context.ContextStorage,Serializable,Comparable<QuarkusContextStorage>
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.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description INSTANCE
-
Field Summary
Fields Modifier and Type Field Description (package private) static io.vertx.core.Vertxvertx
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description io.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.ContextgetVertxContext()Gets the current duplicated context or a new duplicated context if a Vert.x Context exists.static QuarkusContextStoragevalueOf(String name)Returns the enum constant of this type with the specified name.static QuarkusContextStorage[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INSTANCE
public static final QuarkusContextStorage INSTANCE
-
-
Method Detail
-
values
public static QuarkusContextStorage[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (QuarkusContextStorage c : QuarkusContextStorage.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static QuarkusContextStorage valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type 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.
-
-