@Immutable public final class CorrelationsContextUtils extends Object
CorrelationContext contained in the Context.| Modifier and Type | Method and Description |
|---|---|
static io.opentelemetry.context.Scope |
currentContextWith(CorrelationContext corrContext)
|
static CorrelationContext |
getCorrelationContext(io.grpc.Context context)
Returns the
CorrelationContext from the specified Context, falling back to an
empty CorrelationContext. |
static CorrelationContext |
getCorrelationContextWithoutDefault(io.grpc.Context context)
Returns the
CorrelationContext from the specified Context. |
static CorrelationContext |
getCurrentCorrelationContext()
Returns the
CorrelationContext from the current Context, falling back to an
empty CorrelationContext. |
static io.grpc.Context |
withCorrelationContext(CorrelationContext corrContext,
io.grpc.Context context)
Creates a new
Context with the given value set. |
public static io.grpc.Context withCorrelationContext(CorrelationContext corrContext, io.grpc.Context context)
Context with the given value set.corrContext - the value to be set.context - the parent Context.public static CorrelationContext getCurrentCorrelationContext()
CorrelationContext from the current Context, falling back to an
empty CorrelationContext.CorrelationContext from the current Context.public static CorrelationContext getCorrelationContext(io.grpc.Context context)
CorrelationContext from the specified Context, falling back to an
empty CorrelationContext.context - the specified Context.CorrelationContext from the specified Context.@Nullable public static CorrelationContext getCorrelationContextWithoutDefault(io.grpc.Context context)
CorrelationContext from the specified Context. If none is found,
this method returns {code null}.context - the specified Context.CorrelationContext from the specified Context.public static io.opentelemetry.context.Scope currentContextWith(CorrelationContext corrContext)
corrContext - the CorrelationContext to be added to the current Context.Scope for the updated Context.