Class KinesisTemplateObservation.Context
- All Implemented Interfaces:
io.micrometer.observation.Observation.ContextView
- Enclosing class:
- KinesisTemplateObservation
public static class KinesisTemplateObservation.Context
extends io.micrometer.observation.transport.SenderContext<Map<String,String>>
SenderContext for a template send operation.
Kinesis records carry no native headers, so trace context is only propagated when embedded headers are enabled:
the carrier is a Map the tracing instrumentation writes traceparent, tracestate,
b3 and baggage into, and the template embeds those into the record data. With plain records the
collected map is simply never read, so the observation covers the producer side only.
-
Method Summary
Modifier and TypeMethodDescriptionContext for a batch send.Context for a single-record send.int@Nullable StringThe trace-propagation headers the observation injected (traceparent,tracestate,b3,baggage), to be embedded in the sent record when embedded headers are enabled.int@Nullable String@Nullable StringbooleanisBatch()voidsetFailedRecordCount(int failedRecordCount) Record the number of rejected records of a completed batch send.voidsetRecordResult(@Nullable String sequenceNumber, @Nullable String shardId) Record the outcome of a successful single-record send.Methods inherited from class io.micrometer.observation.transport.SenderContext
getCarrier, getKind, getRemoteServiceAddress, getRemoteServiceName, getSetter, setCarrier, setRemoteServiceAddress, setRemoteServiceNameMethods 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.micrometer.observation.Observation.ContextView
getOrDefault
-
Method Details
-
forRecord
Context for a single-record send.- Parameters:
streamName- the target stream.partitionKey- the record partition key.- Returns:
- the context.
-
forBatch
Context for a batch send.- Parameters:
streamName- the target stream.recordCount- the number of records in the batch.- Returns:
- the context.
-
getPropagationHeaders
The trace-propagation headers the observation injected (traceparent,tracestate,b3,baggage), to be embedded in the sent record when embedded headers are enabled. Empty when no tracer is configured.- Returns:
- the injected propagation headers.
-
getStreamName
-
getPartitionKey
-
getRecordCount
public int getRecordCount() -
isBatch
public boolean isBatch() -
getSequenceNumber
-
getShardId
-
getFailedRecordCount
public int getFailedRecordCount() -
setRecordResult
Record the outcome of a successful single-record send.- Parameters:
sequenceNumber- the assigned sequence number.shardId- the shard the record was written to.
-
setFailedRecordCount
public void setFailedRecordCount(int failedRecordCount) Record the number of rejected records of a completed batch send.- Parameters:
failedRecordCount- the number of failed records.
-