Package io.lettuce.core.tracing
Class LettuceObservationContext
- java.lang.Object
-
- io.micrometer.observation.Observation.Context
-
- io.micrometer.observation.transport.SenderContext<Object>
-
- io.lettuce.core.tracing.LettuceObservationContext
-
- All Implemented Interfaces:
io.micrometer.observation.Observation.ContextView
public class LettuceObservationContext extends io.micrometer.observation.transport.SenderContext<Object>
MicrometerObservation.Context
holding Lettuce contextual details.- Since:
- 6.3
- Author:
- Mark Paluch
-
-
Constructor Summary
Constructors Constructor Description LettuceObservationContext(String serviceName)
Create a newLettuceObservationContext
given theserviceName
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RedisCommand<?,?,?>
getRequiredCommand()
Returns the requiredRedisCommand
or throwsIllegalStateException
if no command is associated with the context.Tracing.Endpoint
getRequiredEndpoint()
Returns the requiredTracing.Endpoint
or throwsIllegalStateException
if no endpoint is associated with the context.boolean
hasCommand()
void
setCommand(RedisCommand<?,?,?> command)
Set theRedisCommand
.void
setEndpoint(Tracing.Endpoint endpoint)
Set theTracing.Endpoint
.String
toString()
-
Methods inherited from class io.micrometer.observation.transport.SenderContext
getCarrier, getKind, getRemoteServiceAddress, getRemoteServiceName, getSetter, setCarrier, setRemoteServiceAddress, setRemoteServiceName
-
Methods inherited from class io.micrometer.observation.Observation.Context
addHighCardinalityKeyValue, addHighCardinalityKeyValues, addLowCardinalityKeyValue, addLowCardinalityKeyValues, clear, computeIfAbsent, containsKey, get, getAllKeyValues, getContextualName, getError, getHighCardinalityKeyValue, getHighCardinalityKeyValues, getLowCardinalityKeyValue, getLowCardinalityKeyValues, getName, getOrDefault, getParentObservation, getRequired, put, remove, removeHighCardinalityKeyValue, removeHighCardinalityKeyValues, removeLowCardinalityKeyValue, removeLowCardinalityKeyValues, setContextualName, setError, setName, setParentObservation
-
-
-
-
Constructor Detail
-
LettuceObservationContext
public LettuceObservationContext(String serviceName)
Create a newLettuceObservationContext
given theserviceName
.- Parameters:
serviceName
- service name.
-
-
Method Detail
-
getRequiredCommand
public RedisCommand<?,?,?> getRequiredCommand()
Returns the requiredRedisCommand
or throwsIllegalStateException
if no command is associated with the context. UsehasCommand()
to check if the command is available.- Returns:
- the required
RedisCommand
. - Throws:
IllegalStateException
- if no command is associated with the context.
-
setCommand
public void setCommand(RedisCommand<?,?,?> command)
Set theRedisCommand
.- Parameters:
command
- the traced command.
-
hasCommand
public boolean hasCommand()
- Returns:
true
if the command is available;false
otherwise.
-
getRequiredEndpoint
public Tracing.Endpoint getRequiredEndpoint()
Returns the requiredTracing.Endpoint
or throwsIllegalStateException
if no endpoint is associated with the context.- Returns:
- the required
Tracing.Endpoint
. - Throws:
IllegalStateException
- if no endpoint is associated with the context.
-
setEndpoint
public void setEndpoint(Tracing.Endpoint endpoint)
Set theTracing.Endpoint
.- Parameters:
endpoint
- the traced endpoint.
-
toString
public String toString()
- Overrides:
toString
in classio.micrometer.observation.Observation.Context
-
-