Class HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE>

java.lang.Object
io.opentelemetry.instrumentation.api.instrumenter.http.HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE>

public final class HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> extends Object
  • Method Details

    • setCapturedRequestHeaders

      @CanIgnoreReturnValue public HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> setCapturedRequestHeaders(List<String> requestHeaders)
      Configures the HTTP request headers that will be captured as span attributes as described in HTTP semantic conventions.

      The HTTP request header values will be captured under the http.request.header.<name> attribute key. The <name> part in the attribute key is the normalized header name: lowercase, with dashes replaced by underscores.

      Parameters:
      requestHeaders - A list of HTTP header names.
    • setCapturedResponseHeaders

      @CanIgnoreReturnValue public HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> setCapturedResponseHeaders(List<String> responseHeaders)
      Configures the HTTP response headers that will be captured as span attributes as described in HTTP semantic conventions.

      The HTTP response header values will be captured under the http.response.header.<name> attribute key. The <name> part in the attribute key is the normalized header name: lowercase, with dashes replaced by underscores.

      Parameters:
      responseHeaders - A list of HTTP header names.
    • setKnownMethods

      @CanIgnoreReturnValue public HttpServerAttributesExtractorBuilder<REQUEST,RESPONSE> setKnownMethods(Set<String> knownMethods)
      Configures the extractor to recognize an alternative set of HTTP request methods.

      By default, this extractor defines "known" methods as the ones listed in RFC9110 and the PATCH method defined in RFC5789. If an unknown method is encountered, the extractor will use the value "_OTHER" instead of it and put the original value in an extra http.request.method_original attribute.

      Note: calling this method overrides the default known method sets completely; it does not supplement it.

      Parameters:
      knownMethods - A set of recognized HTTP request methods.
    • build

      public io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor<REQUEST,RESPONSE> build()