Class HttpSpanStatusExtractor<REQUEST,RESPONSE>

java.lang.Object
io.opentelemetry.instrumentation.api.instrumenter.http.HttpSpanStatusExtractor<REQUEST,RESPONSE>
All Implemented Interfaces:
io.opentelemetry.instrumentation.api.instrumenter.SpanStatusExtractor<REQUEST,RESPONSE>

public final class HttpSpanStatusExtractor<REQUEST,RESPONSE> extends Object implements io.opentelemetry.instrumentation.api.instrumenter.SpanStatusExtractor<REQUEST,RESPONSE>
Extractor of the HTTP span status. Instrumentation of HTTP server or client frameworks should use this class to comply with OpenTelemetry HTTP semantic conventions.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <REQUEST, RESPONSE>
    io.opentelemetry.instrumentation.api.instrumenter.SpanStatusExtractor<REQUEST,RESPONSE>
    create(HttpClientAttributesGetter<? super REQUEST,? super RESPONSE> getter)
    Returns the SpanStatusExtractor for HTTP requests, which will use the HTTP status code to determine the StatusCode if available or fallback to the default status otherwise.
    static <REQUEST, RESPONSE>
    io.opentelemetry.instrumentation.api.instrumenter.SpanStatusExtractor<REQUEST,RESPONSE>
    create(HttpServerAttributesGetter<? super REQUEST,? super RESPONSE> getter)
    Returns the SpanStatusExtractor for HTTP requests, which will use the HTTP status code to determine the StatusCode if available or fallback to the default status otherwise.
    io.opentelemetry.api.trace.StatusCode
    extract(REQUEST request, RESPONSE response, Throwable error)
     

    Methods inherited from class java.lang.Object

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

    • create

      public static <REQUEST, RESPONSE> io.opentelemetry.instrumentation.api.instrumenter.SpanStatusExtractor<REQUEST,RESPONSE> create(HttpClientAttributesGetter<? super REQUEST,? super RESPONSE> getter)
      Returns the SpanStatusExtractor for HTTP requests, which will use the HTTP status code to determine the StatusCode if available or fallback to the default status otherwise.
    • create

      public static <REQUEST, RESPONSE> io.opentelemetry.instrumentation.api.instrumenter.SpanStatusExtractor<REQUEST,RESPONSE> create(HttpServerAttributesGetter<? super REQUEST,? super RESPONSE> getter)
      Returns the SpanStatusExtractor for HTTP requests, which will use the HTTP status code to determine the StatusCode if available or fallback to the default status otherwise.
    • extract

      public io.opentelemetry.api.trace.StatusCode extract(REQUEST request, @Nullable RESPONSE response, Throwable error)
      Specified by:
      extract in interface io.opentelemetry.instrumentation.api.instrumenter.SpanStatusExtractor<REQUEST,RESPONSE>