HttpIncubatingAttributes
in
Semantic attributes and corresponding values for http.
Tags
Table of Contents
Constants
- HTTP_CONNECTION_STATE : mixed = 'http.connection.state'
- State of the HTTP connection in the HTTP connection pool.
- HTTP_CONNECTION_STATE_VALUE_ACTIVE : mixed = 'active'
- active state.
- HTTP_CONNECTION_STATE_VALUE_IDLE : mixed = 'idle'
- idle state.
- HTTP_REQUEST_BODY_CONTENT : mixed = 'http.request.body.content'
- The content of the HTTP request body, with any content coding indicated by [Content-Encoding](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-encoding) removed, captured as a string when the request content is textual or as byte array otherwise.
- HTTP_REQUEST_BODY_SIZE : mixed = 'http.request.body.size'
- The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.
- HTTP_REQUEST_HEADER : mixed = 'http.request.header'
- HTTP request headers, `<key>` being the normalized HTTP Header name (lowercase), the value being the header values.
- HTTP_REQUEST_METHOD : mixed = 'http.request.method'
- HTTP request method.
- HTTP_REQUEST_METHOD_ORIGINAL : mixed = 'http.request.method_original'
- Original HTTP method sent by the client in the request line.
- HTTP_REQUEST_METHOD_VALUE_CONNECT : mixed = 'CONNECT'
- CONNECT method.
- HTTP_REQUEST_METHOD_VALUE_DELETE : mixed = 'DELETE'
- DELETE method.
- HTTP_REQUEST_METHOD_VALUE_GET : mixed = 'GET'
- GET method.
- HTTP_REQUEST_METHOD_VALUE_HEAD : mixed = 'HEAD'
- HEAD method.
- HTTP_REQUEST_METHOD_VALUE_OPTIONS : mixed = 'OPTIONS'
- OPTIONS method.
- HTTP_REQUEST_METHOD_VALUE_OTHER : mixed = '_OTHER'
- Any HTTP method that the instrumentation has no prior knowledge of.
- HTTP_REQUEST_METHOD_VALUE_PATCH : mixed = 'PATCH'
- PATCH method.
- HTTP_REQUEST_METHOD_VALUE_POST : mixed = 'POST'
- POST method.
- HTTP_REQUEST_METHOD_VALUE_PUT : mixed = 'PUT'
- PUT method.
- HTTP_REQUEST_METHOD_VALUE_QUERY : mixed = 'QUERY'
- QUERY method.
- HTTP_REQUEST_METHOD_VALUE_TRACE : mixed = 'TRACE'
- TRACE method.
- HTTP_REQUEST_RESEND_COUNT : mixed = 'http.request.resend_count'
- The ordinal number of request resending attempt (for any reason, including redirects).
- HTTP_REQUEST_SIZE : mixed = 'http.request.size'
- The total size of the request in bytes. This should be the total number of bytes sent over the wire, including the request line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and request body if any.
- HTTP_RESPONSE_BODY_CONTENT : mixed = 'http.response.body.content'
- The content of the HTTP response body, with any content coding indicated by [Content-Encoding](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-encoding) removed, captured as a string when the response content is textual or as byte array otherwise.
- HTTP_RESPONSE_BODY_SIZE : mixed = 'http.response.body.size'
- The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.
- HTTP_RESPONSE_HEADER : mixed = 'http.response.header'
- HTTP response headers, `<key>` being the normalized HTTP Header name (lowercase), the value being the header values.
- HTTP_RESPONSE_SIZE : mixed = 'http.response.size'
- The total size of the response in bytes. This should be the total number of bytes sent over the wire, including the status line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and response body and trailers if any.
- HTTP_RESPONSE_STATUS_CODE : mixed = 'http.response.status_code'
- [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).
- HTTP_ROUTE : mixed = 'http.route'
- The matched route template for the request. This MUST be low-cardinality and include all static path segments, with dynamic path segments represented with placeholders.
Constants
HTTP_CONNECTION_STATE
State of the HTTP connection in the HTTP connection pool.
public
mixed
HTTP_CONNECTION_STATE
= 'http.connection.state'
Tags
HTTP_CONNECTION_STATE_VALUE_ACTIVE
active state.
public
mixed
HTTP_CONNECTION_STATE_VALUE_ACTIVE
= 'active'
Tags
HTTP_CONNECTION_STATE_VALUE_IDLE
idle state.
public
mixed
HTTP_CONNECTION_STATE_VALUE_IDLE
= 'idle'
Tags
HTTP_REQUEST_BODY_CONTENT
The content of the HTTP request body, with any content coding indicated by [Content-Encoding](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-encoding) removed, captured as a string when the request content is textual or as byte array otherwise.
public
mixed
HTTP_REQUEST_BODY_CONTENT
= 'http.request.body.content'
Captured value MAY be limited in size and thus value is expected to be truncated in many cases. When an instrumentation applies a byte-based limit while capturing the body as a string, it SHOULD truncate on a character boundary so that the recorded value remains valid text.
Instrumentations MUST NOT capture this attribute by default and MAY provide an option to enable it.
[!WARNING] This attribute may contain sensitive information.
When instrumentations record body, they SHOULD capture the body as string whenever possible as it makes it easier to use in human-readable form, also it allows to implement sanitization if needed.
Textual content is typically detected based on the Content-Type header using heuristics
such as checking if the type/subtype (compared case-insensitively, ignoring any parameters) starts with text/, ends with /json, +json, /xml, +xml, /yaml or +yaml,
is application/x-www-form-urlencoded, or if the header declares a charset parameter.
Instrumentations that implement request body recording MUST NOT intentionally introduce side effects such as changing stream position or closing body stream independently from the application.
When body is recorded, the instrumentation SHOULD record part of the body that was sent or received at the time HTTP call has ended. The value MUST be either a string or a byte array. Instrumentations MUST NOT record a parsed or otherwise structured representation of the body, and MUST NOT base64-encode binary content into a string value.
Tags
HTTP_REQUEST_BODY_SIZE
The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.
public
mixed
HTTP_REQUEST_BODY_SIZE
= 'http.request.body.size'
Tags
HTTP_REQUEST_HEADER
HTTP request headers, `<key>` being the normalized HTTP Header name (lowercase), the value being the header values.
public
mixed
HTTP_REQUEST_HEADER
= 'http.request.header'
Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all request headers can be a security risk - explicit configuration helps avoid leaking sensitive information.
The User-Agent header is already captured in the user_agent.original attribute.
Users MAY explicitly configure instrumentations to capture them even though it is not recommended.
The attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers.
Examples:
- A header
Content-Type: application/jsonSHOULD be recorded as thehttp.request.header.content-typeattribute with value["application/json"]. - A header
X-Forwarded-For: 1.2.3.4, 1.2.3.5SHOULD be recorded as thehttp.request.header.x-forwarded-forattribute with value["1.2.3.4", "1.2.3.5"]or["1.2.3.4, 1.2.3.5"]depending on the HTTP library.
Tags
HTTP_REQUEST_METHOD
HTTP request method.
public
mixed
HTTP_REQUEST_METHOD
= 'http.request.method'
HTTP request method value SHOULD be "known" to the instrumentation. By default, this convention defines "known" methods as the ones listed in RFC9110, the PATCH method defined in RFC5789 and the QUERY method defined in httpbis-safe-method-w-body.
If the HTTP request method is not known to instrumentation, it MUST set the http.request.method attribute to _OTHER.
If the HTTP instrumentation could end up converting valid HTTP request methods to _OTHER, then it MUST provide a way to override
the list of known HTTP methods. If this override is done via environment variable, then the environment variable MUST be named
OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list of case-sensitive known HTTP methods.
If this override is done via declarative configuration, then the list MUST be configurable via the known_methods property
(an array of case-sensitive strings with minimum items 0) under .instrumentation/development.general.http.client and/or
.instrumentation/development.general.http.server.
In either case, this list MUST be a full override of the default known methods, it is not a list of known methods in addition to the defaults.
HTTP method names are case-sensitive and http.request.method attribute value MUST match a known HTTP method name exactly.
Instrumentations for specific web frameworks that consider HTTP methods to be case insensitive, SHOULD populate a canonical equivalent.
Tracing instrumentations that do so, MUST also set http.request.method_original to the original value.
Tags
HTTP_REQUEST_METHOD_ORIGINAL
Original HTTP method sent by the client in the request line.
public
mixed
HTTP_REQUEST_METHOD_ORIGINAL
= 'http.request.method_original'
Tags
HTTP_REQUEST_METHOD_VALUE_CONNECT
CONNECT method.
public
mixed
HTTP_REQUEST_METHOD_VALUE_CONNECT
= 'CONNECT'
Tags
HTTP_REQUEST_METHOD_VALUE_DELETE
DELETE method.
public
mixed
HTTP_REQUEST_METHOD_VALUE_DELETE
= 'DELETE'
Tags
HTTP_REQUEST_METHOD_VALUE_GET
GET method.
public
mixed
HTTP_REQUEST_METHOD_VALUE_GET
= 'GET'
Tags
HTTP_REQUEST_METHOD_VALUE_HEAD
HEAD method.
public
mixed
HTTP_REQUEST_METHOD_VALUE_HEAD
= 'HEAD'
Tags
HTTP_REQUEST_METHOD_VALUE_OPTIONS
OPTIONS method.
public
mixed
HTTP_REQUEST_METHOD_VALUE_OPTIONS
= 'OPTIONS'
Tags
HTTP_REQUEST_METHOD_VALUE_OTHER
Any HTTP method that the instrumentation has no prior knowledge of.
public
mixed
HTTP_REQUEST_METHOD_VALUE_OTHER
= '_OTHER'
Tags
HTTP_REQUEST_METHOD_VALUE_PATCH
PATCH method.
public
mixed
HTTP_REQUEST_METHOD_VALUE_PATCH
= 'PATCH'
Tags
HTTP_REQUEST_METHOD_VALUE_POST
POST method.
public
mixed
HTTP_REQUEST_METHOD_VALUE_POST
= 'POST'
Tags
HTTP_REQUEST_METHOD_VALUE_PUT
PUT method.
public
mixed
HTTP_REQUEST_METHOD_VALUE_PUT
= 'PUT'
Tags
HTTP_REQUEST_METHOD_VALUE_QUERY
QUERY method.
public
mixed
HTTP_REQUEST_METHOD_VALUE_QUERY
= 'QUERY'
Tags
HTTP_REQUEST_METHOD_VALUE_TRACE
TRACE method.
public
mixed
HTTP_REQUEST_METHOD_VALUE_TRACE
= 'TRACE'
Tags
HTTP_REQUEST_RESEND_COUNT
The ordinal number of request resending attempt (for any reason, including redirects).
public
mixed
HTTP_REQUEST_RESEND_COUNT
= 'http.request.resend_count'
The resend count SHOULD be updated each time an HTTP request gets resent by the client, regardless of what was the cause of the resending (e.g. redirection, authorization failure, 503 Server Unavailable, network issues, or any other).
Tags
HTTP_REQUEST_SIZE
The total size of the request in bytes. This should be the total number of bytes sent over the wire, including the request line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and request body if any.
public
mixed
HTTP_REQUEST_SIZE
= 'http.request.size'
Tags
HTTP_RESPONSE_BODY_CONTENT
The content of the HTTP response body, with any content coding indicated by [Content-Encoding](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-encoding) removed, captured as a string when the response content is textual or as byte array otherwise.
public
mixed
HTTP_RESPONSE_BODY_CONTENT
= 'http.response.body.content'
Captured value MAY be limited in size and thus value is expected to be truncated in many cases. When an instrumentation applies a byte-based limit while capturing the body as a string, it SHOULD truncate on a character boundary so that the recorded value remains valid text.
Instrumentations MUST NOT capture this attribute by default and MAY provide an option to enable it.
[!WARNING] This attribute may contain sensitive information.
When instrumentations record body, they SHOULD capture the body as string whenever possible as it makes it easier to use in human-readable form, also it allows to implement sanitization if needed.
Textual content is typically detected based on the Content-Type header using heuristics
such as checking if the type/subtype (compared case-insensitively, ignoring any parameters) starts with text/, ends with /json, +json, /xml, +xml, /yaml or +yaml,
is application/x-www-form-urlencoded, or if the header declares a charset parameter.
Instrumentations that implement response body recording MUST NOT intentionally introduce side effects such as changing stream position or closing body stream independently from the application.
When body is recorded, the instrumentation SHOULD record part of the body that was sent or received at the time HTTP call has ended. Note that HTTP client spans SHOULD end sometime after the response headers are fully read, which may or may not include reading the response body, so on client spans this attribute is often absent or holds only part of the body.
The value MUST be either a string or a byte array. Instrumentations MUST NOT record a parsed or otherwise structured representation of the body, and MUST NOT base64-encode binary content into a string value.
Tags
HTTP_RESPONSE_BODY_SIZE
The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size.
public
mixed
HTTP_RESPONSE_BODY_SIZE
= 'http.response.body.size'
Tags
HTTP_RESPONSE_HEADER
HTTP response headers, `<key>` being the normalized HTTP Header name (lowercase), the value being the header values.
public
mixed
HTTP_RESPONSE_HEADER
= 'http.response.header'
Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all response headers can be a security risk - explicit configuration helps avoid leaking sensitive information.
Users MAY explicitly configure instrumentations to capture them even though it is not recommended.
The attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers.
Examples:
- A header
Content-Type: application/jsonheader SHOULD be recorded as thehttp.request.response.content-typeattribute with value["application/json"]. - A header
My-custom-header: abc, defheader SHOULD be recorded as thehttp.response.header.my-custom-headerattribute with value["abc", "def"]or["abc, def"]depending on the HTTP library.
Tags
HTTP_RESPONSE_SIZE
The total size of the response in bytes. This should be the total number of bytes sent over the wire, including the status line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and response body and trailers if any.
public
mixed
HTTP_RESPONSE_SIZE
= 'http.response.size'
Tags
HTTP_RESPONSE_STATUS_CODE
[HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).
public
mixed
HTTP_RESPONSE_STATUS_CODE
= 'http.response.status_code'
Tags
HTTP_ROUTE
The matched route template for the request. This MUST be low-cardinality and include all static path segments, with dynamic path segments represented with placeholders.
public
mixed
HTTP_ROUTE
= 'http.route'
MUST NOT be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it. SHOULD include the application root if there is one.
A static path segment is a part of the route template with a fixed, low-cardinality value. This includes literal strings like /users/ and placeholders that
are constrained to a finite, predefined set of values, e.g. {controller} or {action}.
A dynamic path segment is a placeholder for a value that can have high cardinality and is not constrained to a predefined list like static path segments.
Instrumentations SHOULD use routing information provided by the corresponding web framework. They SHOULD pick the most precise source of routing information and MAY support custom route formatting. Instrumentations SHOULD document the format and the API used to obtain the route string.