Class SimpleTelemetry

  • All Implemented Interfaces:
    Telemetry

    public class SimpleTelemetry
    extends Object
    implements Telemetry
    Simple implementation of Telemetry for use in tests. Generates a valid W3C traceparent on construction.
    • Constructor Detail

      • SimpleTelemetry

        public SimpleTelemetry()
    • Method Detail

      • getTraceParent

        public String getTraceParent()
        Description copied from interface: Telemetry
        Returns the W3C traceparent value for the currently active span, or null if no valid span is active.

        Example usage, setting a single header on an outgoing request:

        
         String traceParent = telemetry.getTraceParent();
         if (traceParent != null) {
             httpRequest.setHeader("traceparent", traceParent);
         }
         
        Specified by:
        getTraceParent in interface Telemetry
        Returns:
        the traceparent value for the currently active span, or null if no valid span is active
      • getTraceState

        public String getTraceState()
        Description copied from interface: Telemetry
        Returns the W3C tracestate value for the currently active span, or null if no valid span is active.

        Example usage, setting a single header on an outgoing request:

        
         String traceState = telemetry.getTraceState();
         if (traceState != null) {
             httpRequest.setHeader("tracestate", traceState);
         }
         
        Specified by:
        getTraceState in interface Telemetry
        Returns:
        the tracestate value for the currently active span, or null if no valid span is active