HTTP instrumentation configuration

Capturing HTTP request and response headers

You can configure the agent to capture predefined HTTP headers as span attributes, according to the semantic convention. Use the following properties to define which HTTP headers you want to capture:

System property: otel.instrumentation.http.client.capture-request-headersEnvironment variable: OTEL_INSTRUMENTATION_HTTP_CLIENT_CAPTURE_REQUEST_HEADERS

Description: A comma-separated list of HTTP header names. HTTP client instrumentations will capture HTTP request header values for all configured header names.

System property: otel.instrumentation.http.client.capture-response-headersEnvironment variable: OTEL_INSTRUMENTATION_HTTP_CLIENT_CAPTURE_RESPONSE_HEADERS

Description: A comma-separated list of HTTP header names. HTTP client instrumentations will capture HTTP response header values for all configured header names.

System property: otel.instrumentation.http.server.capture-request-headersEnvironment variable: OTEL_INSTRUMENTATION_HTTP_SERVER_CAPTURE_REQUEST_HEADERS

Description: A comma-separated list of HTTP header names. HTTP server instrumentations will capture HTTP request header values for all configured header names.

System property: otel.instrumentation.http.server.capture-response-headersEnvironment variable: OTEL_INSTRUMENTATION_HTTP_SERVER_CAPTURE_RESPONSE_HEADERS

Description: A comma-separated list of HTTP header names. HTTP server instrumentations will capture HTTP response header values for all configured header names.

These configuration options are supported by all HTTP client and server instrumentations.

Note: The property/environment variable names listed in the table are still experimental, and thus are subject to change.

Capturing servlet request parameters

You can configure the agent to capture predefined HTTP request parameter as span attributes for requests that are handled by Servlet API. Use the following property to define which servlet request parameters you want to capture:

System property: otel.instrumentation.servlet.experimental.capture-request-parametersEnvironment variable: OTEL_INSTRUMENTATION_SERVLET_EXPERIMENTAL_CAPTURE_REQUEST_PARAMETERS

Description: A comma-separated list of request parameter names.

Note: The property/environment variable names listed in the table are still experimental, and thus are subject to change.

Configuring known HTTP methods

Configures the instrumentation to recognize an alternative set of HTTP request methods. All other methods will be treated as _OTHER.

System property: otel.instrumentation.http.known-methodsEnvironment variable: OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS

Default: CONNECT,DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT,TRACE
Description: A comma-separated list of known HTTP methods.

Enabling experimental HTTP telemetry

You can configure the agent to capture additional experimental HTTP telemetry data.

System property: otel.instrumentation.http.client.emit-experimental-telemetryEnvironment variable: OTEL_INSTRUMENTATION_HTTP_CLIENT_EMIT_EXPERIMENTAL_TELEMETRY

Default: false
Description: Enables the experimental HTTP client telemetry.

System property: otel.instrumentation.http.server.emit-experimental-telemetryEnvironment variable: OTEL_INSTRUMENTATION_HTTP_SERVER_EMIT_EXPERIMENTAL_TELEMETRY

Default: false
Description: Enables the experimental HTTP server telemetry.

For client and server spans, the following attributes are added:

  • http.request.body.size and http.response.body.size: The size of the request and response bodies, respectively.

For client metrics, the following metrics are created:

For server metrics, the following metrics are created:


Last modified July 18, 2024: re-organize agent config (#4811) (94b83c90)