Interface IdProducer


public interface IdProducer
An abstract access point for retrieving the trace ID and span ID associated with the currently executing operation.

This interface provides a vendor- and implementation-neutral way to obtain tracing identifiers that represent the execution context of the current thread or request.

  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the identifier of the current span within the trace.
    Returns the unique identifier of the trace associated with the current execution.
  • Method Details

    • getTraceId

      String getTraceId()
      Returns the unique identifier of the trace associated with the current execution.

      A trace ID represents an end-to-end request or workflow and remains consistent across service boundaries. By correlating events using this ID, it is possible to understand where and how a request was processed throughout the entire system.

      Returns:
      the trace ID of the current execution, or null if no trace is active
    • getSpanId

      String getSpanId()
      Returns the identifier of the current span within the trace.

      A span represents a single unit of work within a trace, such as a method invocation or an HTTP request. Span IDs are typically used to analyze execution latency, identify performance bottlenecks, and locate errors within a specific part of the overall trace.

      Returns:
      the span ID of the current execution, or null if no span is active