Class TracingSpanUtil

java.lang.Object
io.debezium.transforms.tracing.TracingSpanUtil

public class TracingSpanUtil extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final String
     
    private static final org.slf4j.Logger
     
    private static final io.opentelemetry.api.OpenTelemetry
     
    private static final io.opentelemetry.api.trace.Tracer
     
    private static final String
     
    private static final String
     
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static void
    addFieldToSpan(io.opentelemetry.api.trace.Span span, org.apache.kafka.connect.data.Struct struct, String field, String prefix)
     
    private static void
    debeziumSpan(org.apache.kafka.connect.data.Struct envelope, String operationName)
     
    static <R extends org.apache.kafka.connect.connector.ConnectRecord<R>>
    R
    traceRecord(R connectRecord, org.apache.kafka.connect.data.Struct envelope, org.apache.kafka.connect.data.Struct source, String propagatedSpanContext, String operationName)
    Create tracing spans representing the write operation in the database (the span timestamp is taken from the source event if available), as well as Debezium's processing operation (the span timestamp is taken from the envelope's timestamp).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • DB_FIELDS_PREFIX

      private static final String DB_FIELDS_PREFIX
      See Also:
    • TX_LOG_WRITE_OPERATION_NAME

      private static final String TX_LOG_WRITE_OPERATION_NAME
      See Also:
    • TRACING_COMPONENT

      private static final String TRACING_COMPONENT
    • openTelemetry

      private static final io.opentelemetry.api.OpenTelemetry openTelemetry
    • tracer

      private static final io.opentelemetry.api.trace.Tracer tracer
  • Constructor Details

    • TracingSpanUtil

      private TracingSpanUtil()
  • Method Details

    • traceRecord

      public static <R extends org.apache.kafka.connect.connector.ConnectRecord<R>> R traceRecord(R connectRecord, org.apache.kafka.connect.data.Struct envelope, org.apache.kafka.connect.data.Struct source, String propagatedSpanContext, String operationName)
      Create tracing spans representing the write operation in the database (the span timestamp is taken from the source event if available), as well as Debezium's processing operation (the span timestamp is taken from the envelope's timestamp). If a trace context is provided for propagation, it is set as the parent context of the created spans to enable distributed tracing. The resulting context is injected in the Kafka Connect Record headers for further propagation.
      Type Parameters:
      R - the subtype of ConnectRecord on which this transformation will operate
      Parameters:
      connectRecord - the Connect record that is to be enriched with tracing information
      envelope - the envelope wrapped by the record
      source - the source field of the envelope, or null
      propagatedSpanContext - a String serialization of a Properties instance representing the parent span context that should be used for trace propagation, or null
      operationName - the operation name of the debezium processing span
      Returns:
      the connect record with message headers augmented with tracing information
    • debeziumSpan

      private static void debeziumSpan(org.apache.kafka.connect.data.Struct envelope, String operationName)
    • addFieldToSpan

      private static void addFieldToSpan(io.opentelemetry.api.trace.Span span, org.apache.kafka.connect.data.Struct struct, String field, String prefix)