OpenTelemetry PHP

HttpAttributes

Semantic attributes and corresponding values for http.

Tags
see
https://opentelemetry.io/docs/specs/semconv/registry/attributes/http/

Table of Contents

Constants

HTTP_REQUEST_HEADER  = 'http.request.header'
HTTP request headers, `<key>` being the normalized HTTP Header name (lowercase), the value being the header values.
HTTP_REQUEST_METHOD  = 'http.request.method'
HTTP request method.
HTTP_REQUEST_METHOD_ORIGINAL  = 'http.request.method_original'
Original HTTP method sent by the client in the request line.
HTTP_REQUEST_METHOD_VALUE_CONNECT  = 'CONNECT'
CONNECT method.
HTTP_REQUEST_METHOD_VALUE_DELETE  = 'DELETE'
DELETE method.
HTTP_REQUEST_METHOD_VALUE_GET  = 'GET'
GET method.
HTTP_REQUEST_METHOD_VALUE_HEAD  = 'HEAD'
HEAD method.
HTTP_REQUEST_METHOD_VALUE_OPTIONS  = 'OPTIONS'
OPTIONS method.
HTTP_REQUEST_METHOD_VALUE_OTHER  = '_OTHER'
Any HTTP method that the instrumentation has no prior knowledge of.
HTTP_REQUEST_METHOD_VALUE_PATCH  = 'PATCH'
PATCH method.
HTTP_REQUEST_METHOD_VALUE_POST  = 'POST'
POST method.
HTTP_REQUEST_METHOD_VALUE_PUT  = 'PUT'
PUT method.
HTTP_REQUEST_METHOD_VALUE_TRACE  = 'TRACE'
TRACE method.
HTTP_REQUEST_RESEND_COUNT  = 'http.request.resend_count'
The ordinal number of request resending attempt (for any reason, including redirects).
HTTP_RESPONSE_HEADER  = 'http.response.header'
HTTP response headers, `<key>` being the normalized HTTP Header name (lowercase), the value being the header values.
HTTP_RESPONSE_STATUS_CODE  = 'http.response.status_code'
[HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).
HTTP_ROUTE  = 'http.route'
The matched route, that is, the path template in the format used by the respective server framework.

Constants

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/json SHOULD be recorded as the http.request.header.content-type attribute with value ["application/json"].
  • A header X-Forwarded-For: 1.2.3.4, 1.2.3.5 SHOULD be recorded as the http.request.header.x-forwarded-for attribute 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
stable

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 and the PATCH method defined in RFC5789.

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 (this list MUST be a full override of the default known method, 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
stable

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
stable

HTTP_REQUEST_METHOD_VALUE_CONNECT

CONNECT method.

public mixed HTTP_REQUEST_METHOD_VALUE_CONNECT = 'CONNECT'
Tags
stable

HTTP_REQUEST_METHOD_VALUE_DELETE

DELETE method.

public mixed HTTP_REQUEST_METHOD_VALUE_DELETE = 'DELETE'
Tags
stable

HTTP_REQUEST_METHOD_VALUE_GET

GET method.

public mixed HTTP_REQUEST_METHOD_VALUE_GET = 'GET'
Tags
stable

HTTP_REQUEST_METHOD_VALUE_HEAD

HEAD method.

public mixed HTTP_REQUEST_METHOD_VALUE_HEAD = 'HEAD'
Tags
stable

HTTP_REQUEST_METHOD_VALUE_OPTIONS

OPTIONS method.

public mixed HTTP_REQUEST_METHOD_VALUE_OPTIONS = 'OPTIONS'
Tags
stable

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
stable

HTTP_REQUEST_METHOD_VALUE_PATCH

PATCH method.

public mixed HTTP_REQUEST_METHOD_VALUE_PATCH = 'PATCH'
Tags
stable

HTTP_REQUEST_METHOD_VALUE_POST

POST method.

public mixed HTTP_REQUEST_METHOD_VALUE_POST = 'POST'
Tags
stable

HTTP_REQUEST_METHOD_VALUE_PUT

PUT method.

public mixed HTTP_REQUEST_METHOD_VALUE_PUT = 'PUT'
Tags
stable

HTTP_REQUEST_METHOD_VALUE_TRACE

TRACE method.

public mixed HTTP_REQUEST_METHOD_VALUE_TRACE = 'TRACE'
Tags
stable

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
stable

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/json header SHOULD be recorded as the http.request.response.content-type attribute with value ["application/json"].
  • A header My-custom-header: abc, def header SHOULD be recorded as the http.response.header.my-custom-header attribute with value ["abc", "def"] or ["abc, def"] depending on the HTTP library.
Tags
stable

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
stable

HTTP_ROUTE

The matched route, that is, the path template in the format used by the respective server framework.

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.

Tags
stable

        
On this page

Search results