Enum Class QuarkusContextStorage

java.lang.Object
java.lang.Enum<QuarkusContextStorage>
io.quarkus.opentelemetry.runtime.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
    Enum Constant
    Description
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static io.vertx.core.Vertx
     
  • Method Summary

    Modifier and Type
    Method
    Description
    io.opentelemetry.context.Scope
    attach(io.opentelemetry.context.Context otelToAttach)
    Attach the OpenTelemetry Context to the current Context.
    io.opentelemetry.context.Scope
    attach(io.vertx.core.Context vertxContext, io.opentelemetry.context.Context otelToAttach)
    Attach the OpenTelemetry Context in the Vert.x Context if it is a duplicated Vert.x Context.
    io.opentelemetry.context.Context
    Gets the current OpenTelemetry Context from the current Vert.x Context if one exists or from the default ContextStorage.
    static io.opentelemetry.context.Context
    getOtelContext(io.vertx.core.Context vertxContext)
    Gets the OpenTelemetry Context in a Vert.x Context.
    static io.vertx.core.Context
    Gets the current duplicated context or a new duplicated context if a Vert.x Context exists.
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.opentelemetry.context.ContextStorage

    root
  • Enum Constant Details

  • Field Details

    • vertx

      static io.vertx.core.Vertx vertx
  • Method Details

    • values

      public static QuarkusContextStorage[] 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

      public static QuarkusContextStorage valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • attach

      public io.opentelemetry.context.Scope attach(io.opentelemetry.context.Context otelToAttach)
      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:
      attach in interface io.opentelemetry.context.ContextStorage
      Parameters:
      otelToAttach - 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 otelToAttach)
      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 Context
      otelToAttach - 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:
      current in interface io.opentelemetry.context.ContextStorage
      Returns:
      the current OpenTelemetry Context or null.
    • getOtelContext

      public static io.opentelemetry.context.Context getOtelContext(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.