View Source OpenTelemetry.SemConv.HTTPAttributes (OpenTelemetry.SemConv v1.27.0)

OpenTelemetry Semantic Conventions for HTTP attributes.

Summary

Types

HTTP request method.

Functions

HTTP request headers, <key> being the normalized HTTP Header name (lowercase), the value being the header values.

HTTP request method.

Original HTTP method sent by the client in the request line.

The ordinal number of request resending attempt (for any reason, including redirects).

HTTP response headers, <key> being the normalized HTTP Header name (lowercase), the value being the header values.

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

Types

Link to this type

http_request_method_values()

View Source
@type http_request_method_values() :: %{
  connect: :CONNECT,
  delete: :DELETE,
  get: :GET,
  head: :HEAD,
  options: :OPTIONS,
  patch: :PATCH,
  post: :POST,
  put: :PUT,
  trace: :TRACE,
  other: :_OTHER
}

HTTP request method.

Enum Values

  • :connect - CONNECT method.
  • :delete - DELETE method.
  • :get - GET method.
  • :head - HEAD method.
  • :options - OPTIONS method.
  • :patch - PATCH method.
  • :post - POST method.
  • :put - PUT method.
  • :trace - TRACE method.
  • :other - Any HTTP method that the instrumentation has no prior knowledge of.

Functions

@spec http_request_header() :: :"http.request.header"

HTTP request headers, <key> being the normalized HTTP Header name (lowercase), the value being the header values.

Value type

Value must be of type [atom() | String.t()].

Notes

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

["http.request.header.content-type=["application/json"]", "http.request.header.x-forwarded-for=["1.2.3.4", "1.2.3.5"]"]
iex> OpenTelemetry.SemConv.HTTPAttributes.http_request_header()
:"http.request.header"
@spec http_request_method() :: :"http.request.method"

HTTP request method.

Notes

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.

Examples

["GET", "POST", "HEAD"]
iex> OpenTelemetry.SemConv.HTTPAttributes.http_request_method()
:"http.request.method"

iex> OpenTelemetry.SemConv.HTTPAttributes.http_request_method_values().connect
:CONNECT

iex> %{OpenTelemetry.SemConv.HTTPAttributes.http_request_method() => OpenTelemetry.SemConv.HTTPAttributes.http_request_method_values().connect}
%{:"http.request.method" => :CONNECT}
Link to this function

http_request_method_original()

View Source
@spec http_request_method_original() :: :"http.request.method_original"

Original HTTP method sent by the client in the request line.

Value type

Value must be of type atom() | String.t().

Examples

["GeT", "ACL", "foo"]
iex> OpenTelemetry.SemConv.HTTPAttributes.http_request_method_original()
:"http.request.method_original"
Link to this function

http_request_method_values()

View Source
@spec http_request_method_values() :: http_request_method_values()
Link to this function

http_request_resend_count()

View Source
@spec http_request_resend_count() :: :"http.request.resend_count"

The ordinal number of request resending attempt (for any reason, including redirects).

Value type

Value must be of type integer().

Notes

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).

Examples

3
iex> OpenTelemetry.SemConv.HTTPAttributes.http_request_resend_count()
:"http.request.resend_count"
@spec http_response_header() :: :"http.response.header"

HTTP response headers, <key> being the normalized HTTP Header name (lowercase), the value being the header values.

Value type

Value must be of type [atom() | String.t()].

Notes

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

["http.response.header.content-type=["application/json"]", "http.response.header.my-custom-header=["abc", "def"]"]
iex> OpenTelemetry.SemConv.HTTPAttributes.http_response_header()
:"http.response.header"
Link to this function

http_response_status_code()

View Source
@spec http_response_status_code() :: :"http.response.status_code"

HTTP response status code.

Value type

Value must be of type integer().

Examples

[200]
iex> OpenTelemetry.SemConv.HTTPAttributes.http_response_status_code()
:"http.response.status_code"
@spec http_route() :: :"http.route"

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

Value type

Value must be of type atom() | String.t().

Notes

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.

Examples

["/users/:userID?", "{controller}/{action}/{id?}"]
iex> OpenTelemetry.SemConv.HTTPAttributes.http_route()
:"http.route"