583 lines
37 KiB
Markdown
583 lines
37 KiB
Markdown
<!--- Hugo front matter used to generate the website version of this page:
|
|
linkTitle: Metrics
|
|
--->
|
|
|
|
# Semantic Conventions for HTTP Metrics
|
|
|
|
**Status**: [Experimental, partial feature-freeze][DocumentStatus]
|
|
|
|
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.
|
|
|
|
<!-- toc -->
|
|
|
|
- [HTTP Server](#http-server)
|
|
* [Metric: `http.server.request.duration`](#metric-httpserverrequestduration)
|
|
* [Metric: `http.server.active_requests`](#metric-httpserveractive_requests)
|
|
* [Metric: `http.server.request.size`](#metric-httpserverrequestsize)
|
|
* [Metric: `http.server.response.size`](#metric-httpserverresponsesize)
|
|
- [HTTP Client](#http-client)
|
|
* [Metric: `http.client.request.duration`](#metric-httpclientrequestduration)
|
|
* [Metric: `http.client.request.size`](#metric-httpclientrequestsize)
|
|
* [Metric: `http.client.response.size`](#metric-httpclientresponsesize)
|
|
|
|
<!-- tocstop -->
|
|
|
|
> **Warning**
|
|
> Existing HTTP instrumentations that are using
|
|
> [v1.20.0 of this document](https://github.com/open-telemetry/opentelemetry-specification/blob/v1.20.0/specification/metrics/semantic_conventions/http-metrics.md)
|
|
> (or prior):
|
|
>
|
|
> * SHOULD NOT change the version of the HTTP or networking attributes that they emit
|
|
> until the HTTP semantic conventions are marked stable (HTTP stabilization will
|
|
> include stabilization of a core set of networking attributes which are also used
|
|
> in HTTP instrumentations).
|
|
> * 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 attributes,
|
|
> and stop emitting the old experimental HTTP and networking attributes
|
|
> that the instrumentation emitted previously.
|
|
> * `http/dup` - emit both the old and the stable HTTP and networking attributes,
|
|
> 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 attributes
|
|
> the instrumentation was emitting previously.
|
|
> * SHOULD maintain (security patching at a minimum) the existing major version
|
|
> for at least six months after it starts emitting both sets of attributes.
|
|
> * SHOULD drop the environment variable in the next major version (stable
|
|
> next major version SHOULD NOT be released prior to October 1, 2023).
|
|
|
|
## HTTP Server
|
|
|
|
### Metric: `http.server.request.duration`
|
|
|
|
**Status**: [Experimental, Feature-freeze][DocumentStatus]
|
|
|
|
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`](https://github.com/open-telemetry/opentelemetry-specification/tree/v1.22.0/specification/metrics/api.md#instrument-advice)
|
|
of `[ 0, 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 ]`.
|
|
|
|
<!-- semconv metric.http.server.request.duration(metric_table) -->
|
|
| Name | Instrument Type | Unit (UCUM) | Description |
|
|
| -------- | --------------- | ----------- | -------------- |
|
|
| `http.server.request.duration` | Histogram | `s` | Measures the duration of inbound HTTP requests. |
|
|
<!-- endsemconv -->
|
|
|
|
<!-- semconv metric.http.server.request.duration(full) -->
|
|
| Attribute | Type | Description | Examples | Requirement Level |
|
|
|---|---|---|---|---|
|
|
| `http.route` | string | The matched route (path template in the format used by the respective server framework). See note below [1] | `/users/:userID?`; `{controller}/{action}/{id?}` | Conditionally Required: If and only if it's available |
|
|
| `http.request.method` | string | HTTP request method. [2] | `GET`; `POST`; `HEAD` | Required |
|
|
| `http.response.status_code` | int | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | Conditionally Required: If and only if one was received/sent. |
|
|
| [`network.protocol.name`](../general/attributes.md) | string | [OSI Application Layer](https://osi-model.com/application-layer/) or non-OSI equivalent. The value SHOULD be normalized to lowercase. | `amqp`; `http`; `mqtt` | Recommended |
|
|
| [`network.protocol.version`](../general/attributes.md) | string | Version of the application layer protocol used. See note below. [3] | `3.1.1` | Recommended |
|
|
| [`server.address`](../general/attributes.md) | string | Name of the local HTTP server that received the request. [4] | `example.com` | Opt-In |
|
|
| [`server.port`](../general/attributes.md) | int | Port of the local HTTP server that received the request. [5] | `80`; `8080`; `443` | Opt-In |
|
|
| [`url.scheme`](../url/url.md) | string | The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol. | `http`; `https` | Required |
|
|
|
|
**[1]:** 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](/docs/http/http-spans.md#http-server-definitions) if there is one.
|
|
|
|
**[2]:** HTTP request method value SHOULD be "known" to the instrumentation.
|
|
By default, this convention defines "known" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods)
|
|
and the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html).
|
|
|
|
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]:** `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 used has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should be set to `1.1`.
|
|
|
|
**[4]:** Determined by using the first of the following that applies
|
|
|
|
- The [primary server name](/docs/http/http-spans.md#http-server-definitions) of the matched virtual host. MUST only
|
|
include host identifier.
|
|
- Host identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource)
|
|
if it's sent in absolute-form.
|
|
- Host identifier of the `Host` header
|
|
|
|
SHOULD NOT be set if only IP address is available and capturing name would require a reverse DNS lookup.
|
|
|
|
**[5]:** Determined by using the first of the following that applies
|
|
|
|
- Port identifier of the [primary server host](/docs/http/http-spans.md#http-server-definitions) of the matched virtual host.
|
|
- Port identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource)
|
|
if it's sent in absolute-form.
|
|
- Port identifier of the `Host` header
|
|
|
|
`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.
|
|
|
|
| Value | Description |
|
|
|---|---|
|
|
| `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. |
|
|
<!-- endsemconv -->
|
|
|
|
### Metric: `http.server.active_requests`
|
|
|
|
**Status**: [Experimental][DocumentStatus]
|
|
|
|
This metric is optional.
|
|
|
|
<!-- semconv metric.http.server.active_requests(metric_table) -->
|
|
| Name | Instrument Type | Unit (UCUM) | Description |
|
|
| -------- | --------------- | ----------- | -------------- |
|
|
| `http.server.active_requests` | UpDownCounter | `{request}` | Measures the number of concurrent HTTP requests that are currently in-flight. |
|
|
<!-- endsemconv -->
|
|
|
|
<!-- semconv metric.http.server.active_requests(full) -->
|
|
| Attribute | Type | Description | Examples | Requirement Level |
|
|
|---|---|---|---|---|
|
|
| `http.request.method` | string | HTTP request method. [1] | `GET`; `POST`; `HEAD` | Required |
|
|
| [`server.address`](../general/attributes.md) | string | Name of the local HTTP server that received the request. [2] | `example.com` | Opt-In |
|
|
| [`server.port`](../general/attributes.md) | int | Port of the local HTTP server that received the request. [3] | `80`; `8080`; `443` | Opt-In |
|
|
| [`url.scheme`](../url/url.md) | string | The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol. | `http`; `https` | Required |
|
|
|
|
**[1]:** HTTP request method value SHOULD be "known" to the instrumentation.
|
|
By default, this convention defines "known" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods)
|
|
and the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html).
|
|
|
|
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]:** Determined by using the first of the following that applies
|
|
|
|
- The [primary server name](/docs/http/http-spans.md#http-server-definitions) of the matched virtual host. MUST only
|
|
include host identifier.
|
|
- Host identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource)
|
|
if it's sent in absolute-form.
|
|
- Host identifier of the `Host` header
|
|
|
|
SHOULD NOT be set if only IP address is available and capturing name would require a reverse DNS lookup.
|
|
|
|
**[3]:** Determined by using the first of the following that applies
|
|
|
|
- Port identifier of the [primary server host](/docs/http/http-spans.md#http-server-definitions) of the matched virtual host.
|
|
- Port identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource)
|
|
if it's sent in absolute-form.
|
|
- Port identifier of the `Host` header
|
|
|
|
`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.
|
|
|
|
| Value | Description |
|
|
|---|---|
|
|
| `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. |
|
|
<!-- endsemconv -->
|
|
|
|
### Metric: `http.server.request.size`
|
|
|
|
**Status**: [Experimental][DocumentStatus]
|
|
|
|
This metric is optional.
|
|
|
|
<!-- semconv metric.http.server.request.size(metric_table) -->
|
|
| Name | Instrument Type | Unit (UCUM) | Description |
|
|
| -------- | --------------- | ----------- | -------------- |
|
|
| `http.server.request.size` | Histogram | `By` | Measures the size of HTTP request messages (compressed). |
|
|
<!-- endsemconv -->
|
|
|
|
<!-- semconv metric.http.server.request.size(full) -->
|
|
| Attribute | Type | Description | Examples | Requirement Level |
|
|
|---|---|---|---|---|
|
|
| `http.route` | string | The matched route (path template in the format used by the respective server framework). See note below [1] | `/users/:userID?`; `{controller}/{action}/{id?}` | Conditionally Required: If and only if it's available |
|
|
| `http.request.method` | string | HTTP request method. [2] | `GET`; `POST`; `HEAD` | Required |
|
|
| `http.response.status_code` | int | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | Conditionally Required: If and only if one was received/sent. |
|
|
| [`network.protocol.name`](../general/attributes.md) | string | [OSI Application Layer](https://osi-model.com/application-layer/) or non-OSI equivalent. The value SHOULD be normalized to lowercase. | `amqp`; `http`; `mqtt` | Recommended |
|
|
| [`network.protocol.version`](../general/attributes.md) | string | Version of the application layer protocol used. See note below. [3] | `3.1.1` | Recommended |
|
|
| [`server.address`](../general/attributes.md) | string | Name of the local HTTP server that received the request. [4] | `example.com` | Opt-In |
|
|
| [`server.port`](../general/attributes.md) | int | Port of the local HTTP server that received the request. [5] | `80`; `8080`; `443` | Opt-In |
|
|
| [`url.scheme`](../url/url.md) | string | The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol. | `http`; `https` | Required |
|
|
|
|
**[1]:** 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](/docs/http/http-spans.md#http-server-definitions) if there is one.
|
|
|
|
**[2]:** HTTP request method value SHOULD be "known" to the instrumentation.
|
|
By default, this convention defines "known" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods)
|
|
and the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html).
|
|
|
|
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]:** `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 used has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should be set to `1.1`.
|
|
|
|
**[4]:** Determined by using the first of the following that applies
|
|
|
|
- The [primary server name](/docs/http/http-spans.md#http-server-definitions) of the matched virtual host. MUST only
|
|
include host identifier.
|
|
- Host identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource)
|
|
if it's sent in absolute-form.
|
|
- Host identifier of the `Host` header
|
|
|
|
SHOULD NOT be set if only IP address is available and capturing name would require a reverse DNS lookup.
|
|
|
|
**[5]:** Determined by using the first of the following that applies
|
|
|
|
- Port identifier of the [primary server host](/docs/http/http-spans.md#http-server-definitions) of the matched virtual host.
|
|
- Port identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource)
|
|
if it's sent in absolute-form.
|
|
- Port identifier of the `Host` header
|
|
|
|
`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.
|
|
|
|
| Value | Description |
|
|
|---|---|
|
|
| `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. |
|
|
<!-- endsemconv -->
|
|
|
|
### Metric: `http.server.response.size`
|
|
|
|
**Status**: [Experimental][DocumentStatus]
|
|
|
|
This metric is optional.
|
|
|
|
<!-- semconv metric.http.server.response.size(metric_table) -->
|
|
| Name | Instrument Type | Unit (UCUM) | Description |
|
|
| -------- | --------------- | ----------- | -------------- |
|
|
| `http.server.response.size` | Histogram | `By` | Measures the size of HTTP response messages (compressed). |
|
|
<!-- endsemconv -->
|
|
|
|
<!-- semconv metric.http.server.response.size(full) -->
|
|
| Attribute | Type | Description | Examples | Requirement Level |
|
|
|---|---|---|---|---|
|
|
| `http.route` | string | The matched route (path template in the format used by the respective server framework). See note below [1] | `/users/:userID?`; `{controller}/{action}/{id?}` | Conditionally Required: If and only if it's available |
|
|
| `http.request.method` | string | HTTP request method. [2] | `GET`; `POST`; `HEAD` | Required |
|
|
| `http.response.status_code` | int | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | Conditionally Required: If and only if one was received/sent. |
|
|
| [`network.protocol.name`](../general/attributes.md) | string | [OSI Application Layer](https://osi-model.com/application-layer/) or non-OSI equivalent. The value SHOULD be normalized to lowercase. | `amqp`; `http`; `mqtt` | Recommended |
|
|
| [`network.protocol.version`](../general/attributes.md) | string | Version of the application layer protocol used. See note below. [3] | `3.1.1` | Recommended |
|
|
| [`server.address`](../general/attributes.md) | string | Name of the local HTTP server that received the request. [4] | `example.com` | Opt-In |
|
|
| [`server.port`](../general/attributes.md) | int | Port of the local HTTP server that received the request. [5] | `80`; `8080`; `443` | Opt-In |
|
|
| [`url.scheme`](../url/url.md) | string | The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol. | `http`; `https` | Required |
|
|
|
|
**[1]:** 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](/docs/http/http-spans.md#http-server-definitions) if there is one.
|
|
|
|
**[2]:** HTTP request method value SHOULD be "known" to the instrumentation.
|
|
By default, this convention defines "known" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods)
|
|
and the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html).
|
|
|
|
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]:** `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 used has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should be set to `1.1`.
|
|
|
|
**[4]:** Determined by using the first of the following that applies
|
|
|
|
- The [primary server name](/docs/http/http-spans.md#http-server-definitions) of the matched virtual host. MUST only
|
|
include host identifier.
|
|
- Host identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource)
|
|
if it's sent in absolute-form.
|
|
- Host identifier of the `Host` header
|
|
|
|
SHOULD NOT be set if only IP address is available and capturing name would require a reverse DNS lookup.
|
|
|
|
**[5]:** Determined by using the first of the following that applies
|
|
|
|
- Port identifier of the [primary server host](/docs/http/http-spans.md#http-server-definitions) of the matched virtual host.
|
|
- Port identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource)
|
|
if it's sent in absolute-form.
|
|
- Port identifier of the `Host` header
|
|
|
|
`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.
|
|
|
|
| Value | Description |
|
|
|---|---|
|
|
| `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. |
|
|
<!-- endsemconv -->
|
|
|
|
## HTTP Client
|
|
|
|
### Metric: `http.client.request.duration`
|
|
|
|
**Status**: [Experimental, Feature-freeze][DocumentStatus]
|
|
|
|
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`](https://github.com/open-telemetry/opentelemetry-specification/tree/v1.22.0/specification/metrics/api.md#instrument-advice)
|
|
of `[ 0, 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 ]`.
|
|
|
|
<!-- semconv metric.http.client.request.duration(metric_table) -->
|
|
| Name | Instrument Type | Unit (UCUM) | Description |
|
|
| -------- | --------------- | ----------- | -------------- |
|
|
| `http.client.request.duration` | Histogram | `s` | Measures the duration of outbound HTTP requests. |
|
|
<!-- endsemconv -->
|
|
|
|
<!-- semconv metric.http.client.request.duration(full) -->
|
|
| Attribute | Type | Description | Examples | Requirement Level |
|
|
|---|---|---|---|---|
|
|
| `http.request.method` | string | HTTP request method. [1] | `GET`; `POST`; `HEAD` | Required |
|
|
| `http.response.status_code` | int | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | Conditionally Required: If and only if one was received/sent. |
|
|
| [`network.protocol.name`](../general/attributes.md) | string | [OSI Application Layer](https://osi-model.com/application-layer/) or non-OSI equivalent. The value SHOULD be normalized to lowercase. | `amqp`; `http`; `mqtt` | Recommended |
|
|
| [`network.protocol.version`](../general/attributes.md) | string | Version of the application layer protocol used. See note below. [2] | `3.1.1` | Recommended |
|
|
| [`server.address`](../general/attributes.md) | string | Host identifier of the ["URI origin"](https://www.rfc-editor.org/rfc/rfc9110.html#name-uri-origin) HTTP request is sent to. [3] | `example.com` | Required |
|
|
| [`server.port`](../general/attributes.md) | int | Port identifier of the ["URI origin"](https://www.rfc-editor.org/rfc/rfc9110.html#name-uri-origin) HTTP request is sent to. [4] | `80`; `8080`; `443` | Conditionally Required: [5] |
|
|
| [`server.socket.address`](../general/attributes.md) | string | Server address of the socket connection - IP address or Unix domain socket name. [6] | `10.5.3.2` | Recommended: If different than `server.address`. |
|
|
|
|
**[1]:** HTTP request method value SHOULD be "known" to the instrumentation.
|
|
By default, this convention defines "known" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods)
|
|
and the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html).
|
|
|
|
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]:** `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 used has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should be set to `1.1`.
|
|
|
|
**[3]:** Determined by using the first of the following that applies
|
|
|
|
- Host identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource)
|
|
if it's sent in absolute-form
|
|
- Host identifier of the `Host` header
|
|
|
|
SHOULD NOT be set if capturing it would require an extra DNS lookup.
|
|
|
|
**[4]:** When [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) is absolute URI, `server.port` MUST match URI port identifier, otherwise it MUST match `Host` header port identifier.
|
|
|
|
**[5]:** If not default (`80` for `http` scheme, `443` for `https`).
|
|
|
|
**[6]:** When observed from the client side, this SHOULD represent the immediate server peer address.
|
|
When observed from the server side, this SHOULD represent the physical server address.
|
|
|
|
`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.
|
|
|
|
| Value | Description |
|
|
|---|---|
|
|
| `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. |
|
|
<!-- endsemconv -->
|
|
|
|
### Metric: `http.client.request.size`
|
|
|
|
**Status**: [Experimental][DocumentStatus]
|
|
|
|
This metric is optional.
|
|
|
|
<!-- semconv metric.http.client.request.size(metric_table) -->
|
|
| Name | Instrument Type | Unit (UCUM) | Description |
|
|
| -------- | --------------- | ----------- | -------------- |
|
|
| `http.client.request.size` | Histogram | `By` | Measures the size of HTTP request messages (compressed). |
|
|
<!-- endsemconv -->
|
|
|
|
<!-- semconv metric.http.client.request.size(full) -->
|
|
| Attribute | Type | Description | Examples | Requirement Level |
|
|
|---|---|---|---|---|
|
|
| `http.request.method` | string | HTTP request method. [1] | `GET`; `POST`; `HEAD` | Required |
|
|
| `http.response.status_code` | int | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | Conditionally Required: If and only if one was received/sent. |
|
|
| [`network.protocol.name`](../general/attributes.md) | string | [OSI Application Layer](https://osi-model.com/application-layer/) or non-OSI equivalent. The value SHOULD be normalized to lowercase. | `amqp`; `http`; `mqtt` | Recommended |
|
|
| [`network.protocol.version`](../general/attributes.md) | string | Version of the application layer protocol used. See note below. [2] | `3.1.1` | Recommended |
|
|
| [`server.address`](../general/attributes.md) | string | Host identifier of the ["URI origin"](https://www.rfc-editor.org/rfc/rfc9110.html#name-uri-origin) HTTP request is sent to. [3] | `example.com` | Required |
|
|
| [`server.port`](../general/attributes.md) | int | Port identifier of the ["URI origin"](https://www.rfc-editor.org/rfc/rfc9110.html#name-uri-origin) HTTP request is sent to. [4] | `80`; `8080`; `443` | Conditionally Required: [5] |
|
|
| [`server.socket.address`](../general/attributes.md) | string | Server address of the socket connection - IP address or Unix domain socket name. [6] | `10.5.3.2` | Recommended: If different than `server.address`. |
|
|
|
|
**[1]:** HTTP request method value SHOULD be "known" to the instrumentation.
|
|
By default, this convention defines "known" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods)
|
|
and the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html).
|
|
|
|
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]:** `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 used has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should be set to `1.1`.
|
|
|
|
**[3]:** Determined by using the first of the following that applies
|
|
|
|
- Host identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource)
|
|
if it's sent in absolute-form
|
|
- Host identifier of the `Host` header
|
|
|
|
SHOULD NOT be set if capturing it would require an extra DNS lookup.
|
|
|
|
**[4]:** When [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) is absolute URI, `server.port` MUST match URI port identifier, otherwise it MUST match `Host` header port identifier.
|
|
|
|
**[5]:** If not default (`80` for `http` scheme, `443` for `https`).
|
|
|
|
**[6]:** When observed from the client side, this SHOULD represent the immediate server peer address.
|
|
When observed from the server side, this SHOULD represent the physical server address.
|
|
|
|
`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.
|
|
|
|
| Value | Description |
|
|
|---|---|
|
|
| `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. |
|
|
<!-- endsemconv -->
|
|
|
|
### Metric: `http.client.response.size`
|
|
|
|
**Status**: [Experimental][DocumentStatus]
|
|
|
|
This metric is optional.
|
|
|
|
<!-- semconv metric.http.client.response.size(metric_table) -->
|
|
| Name | Instrument Type | Unit (UCUM) | Description |
|
|
| -------- | --------------- | ----------- | -------------- |
|
|
| `http.client.response.size` | Histogram | `By` | Measures the size of HTTP response messages (compressed). |
|
|
<!-- endsemconv -->
|
|
|
|
<!-- semconv metric.http.client.response.size(full) -->
|
|
| Attribute | Type | Description | Examples | Requirement Level |
|
|
|---|---|---|---|---|
|
|
| `http.request.method` | string | HTTP request method. [1] | `GET`; `POST`; `HEAD` | Required |
|
|
| `http.response.status_code` | int | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | Conditionally Required: If and only if one was received/sent. |
|
|
| [`network.protocol.name`](../general/attributes.md) | string | [OSI Application Layer](https://osi-model.com/application-layer/) or non-OSI equivalent. The value SHOULD be normalized to lowercase. | `amqp`; `http`; `mqtt` | Recommended |
|
|
| [`network.protocol.version`](../general/attributes.md) | string | Version of the application layer protocol used. See note below. [2] | `3.1.1` | Recommended |
|
|
| [`server.address`](../general/attributes.md) | string | Host identifier of the ["URI origin"](https://www.rfc-editor.org/rfc/rfc9110.html#name-uri-origin) HTTP request is sent to. [3] | `example.com` | Required |
|
|
| [`server.port`](../general/attributes.md) | int | Port identifier of the ["URI origin"](https://www.rfc-editor.org/rfc/rfc9110.html#name-uri-origin) HTTP request is sent to. [4] | `80`; `8080`; `443` | Conditionally Required: [5] |
|
|
| [`server.socket.address`](../general/attributes.md) | string | Server address of the socket connection - IP address or Unix domain socket name. [6] | `10.5.3.2` | Recommended: If different than `server.address`. |
|
|
|
|
**[1]:** HTTP request method value SHOULD be "known" to the instrumentation.
|
|
By default, this convention defines "known" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods)
|
|
and the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html).
|
|
|
|
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]:** `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 used has a version of `0.27.2`, but sends HTTP version `1.1`, this attribute should be set to `1.1`.
|
|
|
|
**[3]:** Determined by using the first of the following that applies
|
|
|
|
- Host identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource)
|
|
if it's sent in absolute-form
|
|
- Host identifier of the `Host` header
|
|
|
|
SHOULD NOT be set if capturing it would require an extra DNS lookup.
|
|
|
|
**[4]:** When [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) is absolute URI, `server.port` MUST match URI port identifier, otherwise it MUST match `Host` header port identifier.
|
|
|
|
**[5]:** If not default (`80` for `http` scheme, `443` for `https`).
|
|
|
|
**[6]:** When observed from the client side, this SHOULD represent the immediate server peer address.
|
|
When observed from the server side, this SHOULD represent the physical server address.
|
|
|
|
`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.
|
|
|
|
| Value | Description |
|
|
|---|---|
|
|
| `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. |
|
|
<!-- endsemconv -->
|
|
|
|
[DocumentStatus]: https://github.com/open-telemetry/opentelemetry-specification/tree/v1.22.0/specification/document-status.md
|