Semantic Conventions for HTTP Metrics

Status: Mixed

The conventions described in this section are HTTP specific. When HTTP operations occur, metric events about those operations will be generated and reported to provide insight into the operations. By adding HTTP attributes to metric events it allows for finely tuned filtering.

Disclaimer: These are initial HTTP metric instruments and attributes but more may be added in the future.

Warning Existing HTTP instrumentations that are using v1.20.0 of this document (or prior):

  • SHOULD NOT change the version of the HTTP or networking conventions that they emit until the HTTP semantic conventions are marked stable (HTTP stabilization will include stabilization of a core set of networking conventions which are also used in HTTP instrumentations). Conventions include, but are not limited to, attributes, metric and span names, and unit of measure.
  • SHOULD introduce an environment variable OTEL_SEMCONV_STABILITY_OPT_IN in the existing major version which is a comma-separated list of values. The only values defined so far are:
    • http - emit the new, stable HTTP and networking conventions, and stop emitting the old experimental HTTP and networking conventions that the instrumentation emitted previously.
    • http/dup - emit both the old and the stable HTTP and networking conventions, allowing for a seamless transition.
    • The default behavior (in the absence of one of these values) is to continue emitting whatever version of the old experimental HTTP and networking conventions the instrumentation was emitting previously.
    • Note: http/dup has higher precedence than http in case both values are present
  • SHOULD maintain (security patching at a minimum) the existing major version for at least six months after it starts emitting both sets of conventions.
  • SHOULD drop the environment variable in the next major version.

HTTP Server

Metric: http.server.request.duration

Status: Stable

This metric is required.

When this metric is reported alongside an HTTP server span, the metric value SHOULD be the same as the HTTP server span duration.

This metric SHOULD be specified with ExplicitBucketBoundaries of [ 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10 ].

NameInstrument TypeUnit (UCUM)Description
http.server.request.durationHistogramsDuration of HTTP server requests.
AttributeTypeDescriptionExamplesRequirement Level
error.typestringDescribes a class of error the operation ended with. [1]timeout; java.net.UnknownHostException; server_certificate_invalid; 500Conditionally Required: If request has ended with an error.
http.request.methodstringHTTP request method. [2]GET; POST; HEADRequired
http.response.status_codeintHTTP response status code.200Conditionally Required: If and only if one was received/sent.
http.routestringThe matched route, that is, the path template in the format used by the respective server framework. [3]/users/:userID?; {controller}/{action}/{id?}Conditionally Required: If and only if it’s available
network.protocol.namestringOSI application layer or non-OSI equivalent. [4]http; spdyConditionally Required: [5]
network.protocol.versionstringVersion of the protocol specified in network.protocol.name. [6]1.0; 1.1; 2; 3Recommended
server.addressstringName of the local HTTP server that received the request. [7]example.com; 10.1.2.80; /tmp/my.sockOpt-In
server.portintPort of the local HTTP server that received the request. [8]80; 8080; 443Opt-In
url.schemestringThe URI scheme component identifying the used protocol. [9]http; httpsRequired

[1]: If the request fails with an error before response status code was sent or received, error.type SHOULD be set to exception type (its fully-qualified class name, if applicable) or a component-specific low cardinality error identifier.

If response status code was sent or received and status indicates an error according to HTTP span status definition, error.type SHOULD be set to the status code number (represented as a string), an exception type (if thrown) or a component-specific error identifier.

The error.type value SHOULD be predictable and SHOULD have low cardinality. Instrumentations SHOULD document the list of errors they report.

The cardinality of error.type within one instrumentation library SHOULD be low, but telemetry consumers that aggregate data from multiple instrumentation libraries and applications should be prepared for error.type to have high cardinality at query time, when no additional filters are applied.

If the request has completed successfully, instrumentations SHOULD NOT set error.type.

[2]: 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.

[3]: 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.

[4]: The value SHOULD be normalized to lowercase.

[5]: If not http and network.protocol.version is set.

[6]: network.protocol.version refers to the version of the protocol used and might be different from the protocol client’s version. If the HTTP client has a version of 0.27.2, but sends HTTP version 1.1, this attribute should be set to 1.1.

[7]: See Setting server.address and server.port attributes.

Warning Since this attribute is based on HTTP headers, opting in to it may allow an attacker to trigger cardinality limits, degrading the usefulness of the metric.

[8]: See Setting server.address and server.port attributes.

Warning Since this attribute is based on HTTP headers, opting in to it may allow an attacker to trigger cardinality limits, degrading the usefulness of the metric.

[9]: The scheme of the original client request, if known (e.g. from Forwarded#proto, X-Forwarded-Proto, or a similar header). Otherwise, the scheme of the immediate peer request.

error.type has the following list of well-known values. If one of them applies, then the respective value MUST be used, otherwise a custom value MAY be used.

ValueDescription
_OTHERA fallback error value to be used when the instrumentation doesn’t define a custom value.

http.request.method has the following list of well-known values. If one of them applies, then the respective value MUST be used, otherwise a custom value MAY be used.

ValueDescription
CONNECTCONNECT method.
DELETEDELETE method.
GETGET method.
HEADHEAD method.
OPTIONSOPTIONS method.
PATCHPATCH method.
POSTPOST method.
PUTPUT method.
TRACETRACE method.
_OTHERAny HTTP method that the instrumentation has no prior knowledge of.

Metric: http.server.active_requests

Status: Experimental

This metric is optional.

NameInstrument TypeUnit (UCUM)Description
http.server.active_requestsUpDownCounter{request}Number of active HTTP server requests.
AttributeTypeDescriptionExamplesRequirement Level
http.request.methodstringHTTP request method. [1]GET; POST; HEADRequired
server.addressstringName of the local HTTP server that received the request. [2]example.com; 10.1.2.80; /tmp/my.sockOpt-In
server.portintPort of the local HTTP server that received the request. [3]80; 8080; 443Opt-In
url.schemestringThe URI scheme component identifying the used protocol.http; httpsRequired

[1]: 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.

[2]: See Setting server.address and server.port attributes.

Warning Since this attribute is based on HTTP headers, opting in to it may allow an attacker to trigger cardinality limits, degrading the usefulness of the metric.

[3]: See Setting server.address and server.port attributes.

Warning Since this attribute is based on HTTP headers, opting in to it may allow an attacker to trigger cardinality limits, degrading the usefulness of the metric.

http.request.method has the following list of well-known values. If one of them applies, then the respective value MUST be used, otherwise a custom value MAY be used.

ValueDescription
CONNECTCONNECT method.
DELETEDELETE method.
GETGET method.
HEADHEAD method.
OPTIONSOPTIONS method.
PATCHPATCH method.
POSTPOST method.
PUTPUT method.
TRACETRACE method.
_OTHERAny HTTP method that the instrumentation has no prior knowledge of.

Metric: http.server.request.body.size

Status: Experimental

This metric is optional.

NameInstrument TypeUnit (UCUM)Description
http.server.request.body.sizeHistogramBySize of HTTP server request bodies. [1]

[1]: 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 header. For requests using transport encoding, this should be the compressed size.

AttributeTypeDescriptionExamplesRequirement Level
error.typestringDescribes a class of error the operation ended with. [1]timeout; java.net.UnknownHostException; server_certificate_invalid; 500Conditionally Required: If request has ended with an error.
http.request.methodstringHTTP request method. [2]GET; POST; HEADRequired
http.response.status_codeintHTTP response status code.200Conditionally Required: If and only if one was received/sent.
http.routestringThe matched route, that is, the path template in the format used by the respective server framework. [3]/users/:userID?; {controller}/{action}/{id?}Conditionally Required: If and only if it’s available
network.protocol.namestringOSI application layer or non-OSI equivalent. [4]http; spdyConditionally Required: [5]
network.protocol.versionstringVersion of the protocol specified in network.protocol.name. [6]1.0; 1.1; 2; 3Recommended
server.addressstringName of the local HTTP server that received the request. [7]example.com; 10.1.2.80; /tmp/my.sockOpt-In
server.portintPort of the local HTTP server that received the request. [8]80; 8080; 443Opt-In
url.schemestringThe URI scheme component identifying the used protocol. [9]http; httpsRequired

[1]: If the request fails with an error before response status code was sent or received, error.type SHOULD be set to exception type (its fully-qualified class name, if applicable) or a component-specific low cardinality error identifier.

If response status code was sent or received and status indicates an error according to HTTP span status definition, error.type SHOULD be set to the status code number (represented as a string), an exception type (if thrown) or a component-specific error identifier.

The error.type value SHOULD be predictable and SHOULD have low cardinality. Instrumentations SHOULD document the list of errors they report.

The cardinality of error.type within one instrumentation library SHOULD be low, but telemetry consumers that aggregate data from multiple instrumentation libraries and applications should be prepared for error.type to have high cardinality at query time, when no additional filters are applied.

If the request has completed successfully, instrumentations SHOULD NOT set error.type.

[2]: 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.

[3]: 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.

[4]: The value SHOULD be normalized to lowercase.

[5]: If not http and network.protocol.version is set.

[6]: network.protocol.version refers to the version of the protocol used and might be different from the protocol client’s version. If the HTTP client has a version of 0.27.2, but sends HTTP version 1.1, this attribute should be set to 1.1.

[7]: See Setting server.address and server.port attributes.

Warning Since this attribute is based on HTTP headers, opting in to it may allow an attacker to trigger cardinality limits, degrading the usefulness of the metric.

[8]: See Setting server.address and server.port attributes.

Warning Since this attribute is based on HTTP headers, opting in to it may allow an attacker to trigger cardinality limits, degrading the usefulness of the metric.

[9]: The scheme of the original client request, if known (e.g. from Forwarded#proto, X-Forwarded-Proto, or a similar header). Otherwise, the scheme of the immediate peer request.

error.type has the following list of well-known values. If one of them applies, then the respective value MUST be used, otherwise a custom value MAY be used.

ValueDescription
_OTHERA fallback error value to be used when the instrumentation doesn’t define a custom value.

http.request.method has the following list of well-known values. If one of them applies, then the respective value MUST be used, otherwise a custom value MAY be used.

ValueDescription
CONNECTCONNECT method.
DELETEDELETE method.
GETGET method.
HEADHEAD method.
OPTIONSOPTIONS method.
PATCHPATCH method.
POSTPOST method.
PUTPUT method.
TRACETRACE method.
_OTHERAny HTTP method that the instrumentation has no prior knowledge of.

Metric: http.server.response.body.size

Status: Experimental

This metric is optional.

NameInstrument TypeUnit (UCUM)Description
http.server.response.body.sizeHistogramBySize of HTTP server response bodies. [1]

[1]: 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 header. For requests using transport encoding, this should be the compressed size.

AttributeTypeDescriptionExamplesRequirement Level
error.typestringDescribes a class of error the operation ended with. [1]timeout; java.net.UnknownHostException; server_certificate_invalid; 500Conditionally Required: If request has ended with an error.
http.request.methodstringHTTP request method. [2]GET; POST; HEADRequired
http.response.status_codeintHTTP response status code.200Conditionally Required: If and only if one was received/sent.
http.routestringThe matched route, that is, the path template in the format used by the respective server framework. [3]/users/:userID?; {controller}/{action}/{id?}Conditionally Required: If and only if it’s available
network.protocol.namestringOSI application layer or non-OSI equivalent. [4]http; spdyConditionally Required: [5]
network.protocol.versionstringVersion of the protocol specified in network.protocol.name. [6]1.0; 1.1; 2; 3Recommended
server.addressstringName of the local HTTP server that received the request. [7]example.com; 10.1.2.80; /tmp/my.sockOpt-In
server.portintPort of the local HTTP server that received the request. [8]80; 8080; 443Opt-In
url.schemestringThe URI scheme component identifying the used protocol. [9]http; httpsRequired

[1]: If the request fails with an error before response status code was sent or received, error.type SHOULD be set to exception type (its fully-qualified class name, if applicable) or a component-specific low cardinality error identifier.

If response status code was sent or received and status indicates an error according to HTTP span status definition, error.type SHOULD be set to the status code number (represented as a string), an exception type (if thrown) or a component-specific error identifier.

The error.type value SHOULD be predictable and SHOULD have low cardinality. Instrumentations SHOULD document the list of errors they report.

The cardinality of error.type within one instrumentation library SHOULD be low, but telemetry consumers that aggregate data from multiple instrumentation libraries and applications should be prepared for error.type to have high cardinality at query time, when no additional filters are applied.

If the request has completed successfully, instrumentations SHOULD NOT set error.type.

[2]: 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.

[3]: 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.

[4]: The value SHOULD be normalized to lowercase.

[5]: If not http and network.protocol.version is set.

[6]: network.protocol.version refers to the version of the protocol used and might be different from the protocol client’s version. If the HTTP client has a version of 0.27.2, but sends HTTP version 1.1, this attribute should be set to 1.1.

[7]: See Setting server.address and server.port attributes.

Warning Since this attribute is based on HTTP headers, opting in to it may allow an attacker to trigger cardinality limits, degrading the usefulness of the metric.

[8]: See Setting server.address and server.port attributes.

Warning Since this attribute is based on HTTP headers, opting in to it may allow an attacker to trigger cardinality limits, degrading the usefulness of the metric.

[9]: The scheme of the original client request, if known (e.g. from Forwarded#proto, X-Forwarded-Proto, or a similar header). Otherwise, the scheme of the immediate peer request.

error.type has the following list of well-known values. If one of them applies, then the respective value MUST be used, otherwise a custom value MAY be used.

ValueDescription
_OTHERA fallback error value to be used when the instrumentation doesn’t define a custom value.

http.request.method has the following list of well-known values. If one of them applies, then the respective value MUST be used, otherwise a custom value MAY be used.

ValueDescription
CONNECTCONNECT method.
DELETEDELETE method.
GETGET method.
HEADHEAD method.
OPTIONSOPTIONS method.
PATCHPATCH method.
POSTPOST method.
PUTPUT method.
TRACETRACE method.
_OTHERAny HTTP method that the instrumentation has no prior knowledge of.

HTTP Client

Metric: http.client.request.duration

Status: Stable

This metric is required.

When this metric is reported alongside an HTTP client span, the metric value SHOULD be the same as the HTTP client span duration.

This metric SHOULD be specified with ExplicitBucketBoundaries of [ 0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10 ].

NameInstrument TypeUnit (UCUM)Description
http.client.request.durationHistogramsDuration of HTTP client requests.
AttributeTypeDescriptionExamplesRequirement Level
error.typestringDescribes a class of error the operation ended with. [1]timeout; java.net.UnknownHostException; server_certificate_invalid; 500Conditionally Required: If request has ended with an error.
http.request.methodstringHTTP request method. [2]GET; POST; HEADRequired
http.response.status_codeintHTTP response status code.200Conditionally Required: If and only if one was received/sent.
network.protocol.namestringOSI application layer or non-OSI equivalent. [3]http; spdyConditionally Required: [4]
network.protocol.versionstringVersion of the protocol specified in network.protocol.name. [5]1.0; 1.1; 2; 3Recommended
server.addressstringHost identifier of the “URI origin” HTTP request is sent to. [6]example.com; 10.1.2.80; /tmp/my.sockRequired
server.portintPort identifier of the “URI origin” HTTP request is sent to. [7]80; 8080; 443Required
url.schemestringThe URI scheme component identifying the used protocol.http; httpsOpt-In

[1]: If the request fails with an error before response status code was sent or received, error.type SHOULD be set to exception type (its fully-qualified class name, if applicable) or a component-specific low cardinality error identifier.

If response status code was sent or received and status indicates an error according to HTTP span status definition, error.type SHOULD be set to the status code number (represented as a string), an exception type (if thrown) or a component-specific error identifier.

The error.type value SHOULD be predictable and SHOULD have low cardinality. Instrumentations SHOULD document the list of errors they report.

The cardinality of error.type within one instrumentation library SHOULD be low, but telemetry consumers that aggregate data from multiple instrumentation libraries and applications should be prepared for error.type to have high cardinality at query time, when no additional filters are applied.

If the request has completed successfully, instrumentations SHOULD NOT set error.type.

[2]: 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.

[3]: The value SHOULD be normalized to lowercase.

[4]: If not http and network.protocol.version is set.

[5]: network.protocol.version refers to the version of the protocol used and might be different from the protocol client’s version. If the HTTP client has a version of 0.27.2, but sends HTTP version 1.1, this attribute should be set to 1.1.

[6]: If an HTTP client request is explicitly made to an IP address, e.g. http://x.x.x.x:8080, then server.address SHOULD be the IP address x.x.x.x. A DNS lookup SHOULD NOT be used.

[7]: When observed from the client side, and when communicating through an intermediary, server.port SHOULD represent the server port behind any intermediaries, for example proxies, if it’s available.

error.type has the following list of well-known values. If one of them applies, then the respective value MUST be used, otherwise a custom value MAY be used.

ValueDescription
_OTHERA fallback error value to be used when the instrumentation doesn’t define a custom value.

http.request.method has the following list of well-known values. If one of them applies, then the respective value MUST be used, otherwise a custom value MAY be used.

ValueDescription
CONNECTCONNECT method.
DELETEDELETE method.
GETGET method.
HEADHEAD method.
OPTIONSOPTIONS method.
PATCHPATCH method.
POSTPOST method.
PUTPUT method.
TRACETRACE method.
_OTHERAny HTTP method that the instrumentation has no prior knowledge of.

Metric: http.client.request.body.size

Status: Experimental

This metric is optional.

NameInstrument TypeUnit (UCUM)Description
http.client.request.body.sizeHistogramBySize of HTTP client request bodies. [1]

[1]: 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 header. For requests using transport encoding, this should be the compressed size.

AttributeTypeDescriptionExamplesRequirement Level
error.typestringDescribes a class of error the operation ended with. [1]timeout; java.net.UnknownHostException; server_certificate_invalid; 500Conditionally Required: If request has ended with an error.
http.request.methodstringHTTP request method. [2]GET; POST; HEADRequired
http.response.status_codeintHTTP response status code.200Conditionally Required: If and only if one was received/sent.
network.protocol.namestringOSI application layer or non-OSI equivalent. [3]http; spdyConditionally Required: [4]
network.protocol.versionstringVersion of the protocol specified in network.protocol.name. [5]1.0; 1.1; 2; 3Recommended
server.addressstringHost identifier of the “URI origin” HTTP request is sent to. [6]example.com; 10.1.2.80; /tmp/my.sockRequired
server.portintPort identifier of the “URI origin” HTTP request is sent to. [7]80; 8080; 443Required
url.schemestringThe URI scheme component identifying the used protocol.http; httpsOpt-In

[1]: If the request fails with an error before response status code was sent or received, error.type SHOULD be set to exception type (its fully-qualified class name, if applicable) or a component-specific low cardinality error identifier.

If response status code was sent or received and status indicates an error according to HTTP span status definition, error.type SHOULD be set to the status code number (represented as a string), an exception type (if thrown) or a component-specific error identifier.

The error.type value SHOULD be predictable and SHOULD have low cardinality. Instrumentations SHOULD document the list of errors they report.

The cardinality of error.type within one instrumentation library SHOULD be low, but telemetry consumers that aggregate data from multiple instrumentation libraries and applications should be prepared for error.type to have high cardinality at query time, when no additional filters are applied.

If the request has completed successfully, instrumentations SHOULD NOT set error.type.

[2]: 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.

[3]: The value SHOULD be normalized to lowercase.

[4]: If not http and network.protocol.version is set.

[5]: network.protocol.version refers to the version of the protocol used and might be different from the protocol client’s version. If the HTTP client has a version of 0.27.2, but sends HTTP version 1.1, this attribute should be set to 1.1.

[6]: If an HTTP client request is explicitly made to an IP address, e.g. http://x.x.x.x:8080, then server.address SHOULD be the IP address x.x.x.x. A DNS lookup SHOULD NOT be used.

[7]: When observed from the client side, and when communicating through an intermediary, server.port SHOULD represent the server port behind any intermediaries, for example proxies, if it’s available.

error.type has the following list of well-known values. If one of them applies, then the respective value MUST be used, otherwise a custom value MAY be used.

ValueDescription
_OTHERA fallback error value to be used when the instrumentation doesn’t define a custom value.

http.request.method has the following list of well-known values. If one of them applies, then the respective value MUST be used, otherwise a custom value MAY be used.

ValueDescription
CONNECTCONNECT method.
DELETEDELETE method.
GETGET method.
HEADHEAD method.
OPTIONSOPTIONS method.
PATCHPATCH method.
POSTPOST method.
PUTPUT method.
TRACETRACE method.
_OTHERAny HTTP method that the instrumentation has no prior knowledge of.

Metric: http.client.response.body.size

Status: Experimental

This metric is optional.

NameInstrument TypeUnit (UCUM)Description
http.client.response.body.sizeHistogramBySize of HTTP client response bodies. [1]

[1]: 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 header. For requests using transport encoding, this should be the compressed size.

AttributeTypeDescriptionExamplesRequirement Level
error.typestringDescribes a class of error the operation ended with. [1]timeout; java.net.UnknownHostException; server_certificate_invalid; 500Conditionally Required: If request has ended with an error.
http.request.methodstringHTTP request method. [2]GET; POST; HEADRequired
http.response.status_codeintHTTP response status code.200Conditionally Required: If and only if one was received/sent.
network.protocol.namestringOSI application layer or non-OSI equivalent. [3]http; spdyConditionally Required: [4]
network.protocol.versionstringVersion of the protocol specified in network.protocol.name. [5]1.0; 1.1; 2; 3Recommended
server.addressstringHost identifier of the “URI origin” HTTP request is sent to. [6]example.com; 10.1.2.80; /tmp/my.sockRequired
server.portintPort identifier of the “URI origin” HTTP request is sent to. [7]80; 8080; 443Required
url.schemestringThe URI scheme component identifying the used protocol.http; httpsOpt-In

[1]: If the request fails with an error before response status code was sent or received, error.type SHOULD be set to exception type (its fully-qualified class name, if applicable) or a component-specific low cardinality error identifier.

If response status code was sent or received and status indicates an error according to HTTP span status definition, error.type SHOULD be set to the status code number (represented as a string), an exception type (if thrown) or a component-specific error identifier.

The error.type value SHOULD be predictable and SHOULD have low cardinality. Instrumentations SHOULD document the list of errors they report.

The cardinality of error.type within one instrumentation library SHOULD be low, but telemetry consumers that aggregate data from multiple instrumentation libraries and applications should be prepared for error.type to have high cardinality at query time, when no additional filters are applied.

If the request has completed successfully, instrumentations SHOULD NOT set error.type.

[2]: 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.

[3]: The value SHOULD be normalized to lowercase.

[4]: If not http and network.protocol.version is set.

[5]: network.protocol.version refers to the version of the protocol used and might be different from the protocol client’s version. If the HTTP client has a version of 0.27.2, but sends HTTP version 1.1, this attribute should be set to 1.1.

[6]: If an HTTP client request is explicitly made to an IP address, e.g. http://x.x.x.x:8080, then server.address SHOULD be the IP address x.x.x.x. A DNS lookup SHOULD NOT be used.

[7]: When observed from the client side, and when communicating through an intermediary, server.port SHOULD represent the server port behind any intermediaries, for example proxies, if it’s available.

error.type has the following list of well-known values. If one of them applies, then the respective value MUST be used, otherwise a custom value MAY be used.

ValueDescription
_OTHERA fallback error value to be used when the instrumentation doesn’t define a custom value.

http.request.method has the following list of well-known values. If one of them applies, then the respective value MUST be used, otherwise a custom value MAY be used.

ValueDescription
CONNECTCONNECT method.
DELETEDELETE method.
GETGET method.
HEADHEAD method.
OPTIONSOPTIONS method.
PATCHPATCH method.
POSTPOST method.
PUTPUT method.
TRACETRACE method.
_OTHERAny HTTP method that the instrumentation has no prior knowledge of.