Class CapturedHttpHeaders


  • public abstract class CapturedHttpHeaders
    extends Object
    Represents the configuration that specifies which HTTP request and response headers should 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 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.

    • Method Detail

      • empty

        public static CapturedHttpHeaders empty()
        Returns a configuration that does not capture any HTTP headers as span attributes.
      • client

        public static CapturedHttpHeaders client​(Config config)
        Returns a configuration that captures HTTP client request and response headers as configured in the received config.
      • server

        public static CapturedHttpHeaders server​(Config config)
        Returns a configuration that captures HTTP server request and response headers as configured in the received config.
      • create

        public static CapturedHttpHeaders create​(List<String> capturedRequestHeaders,
                                                 List<String> capturedResponseHeaders)
        Returns a configuration that captures chosen HTTP request and response headers.
        Parameters:
        capturedRequestHeaders - A list of HTTP request header names that are to be captured as span attributes.
        capturedResponseHeaders - A list of HTTP response header names that are to be captured as span attributes.
      • requestHeaders

        public abstract List<String> requestHeaders()
        Returns the list of HTTP request header names that are to be captured as span attributes.
      • responseHeaders

        public abstract List<String> responseHeaders()
        Returns the list of HTTP response header names that are to be captured as span attributes.