Class KinesisTemplateObservation.Context

java.lang.Object
io.micrometer.observation.Observation.Context
io.micrometer.observation.transport.SenderContext<Map<String,String>>
io.awspring.cloud.kinesis.support.observation.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 Type
    Method
    Description
    forBatch(String streamName, int recordCount)
    Context for a batch send.
    forRecord(String streamName, String partitionKey)
    Context for a single-record send.
    int
     
    @Nullable String
     
    The 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 String
     
     
    boolean
     
    void
    setFailedRecordCount(int failedRecordCount)
    Record the number of rejected records of a completed batch send.
    void
    setRecordResult(@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, 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, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.micrometer.observation.Observation.ContextView

    getOrDefault
  • Method Details

    • forRecord

      public static KinesisTemplateObservation.Context forRecord(String streamName, String partitionKey)
      Context for a single-record send.
      Parameters:
      streamName - the target stream.
      partitionKey - the record partition key.
      Returns:
      the context.
    • forBatch

      public static KinesisTemplateObservation.Context forBatch(String streamName, int recordCount)
      Context for a batch send.
      Parameters:
      streamName - the target stream.
      recordCount - the number of records in the batch.
      Returns:
      the context.
    • getPropagationHeaders

      public Map<String,String> 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

      public String getStreamName()
    • getPartitionKey

      public @Nullable String getPartitionKey()
    • getRecordCount

      public int getRecordCount()
    • isBatch

      public boolean isBatch()
    • getSequenceNumber

      public @Nullable String getSequenceNumber()
    • getShardId

      public @Nullable String getShardId()
    • getFailedRecordCount

      public int getFailedRecordCount()
    • setRecordResult

      public void setRecordResult(@Nullable String sequenceNumber, @Nullable String shardId)
      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.