Skip to content

Commit

Permalink
Add http metrics yaml (#3158)
Browse files Browse the repository at this point in the history
* Add http metrics yaml

* Update change log

* Fix notes

* Fix link

* Remove unnecessary field
  • Loading branch information
trask committed Feb 6, 2023
1 parent 17013e7 commit 1002125
Show file tree
Hide file tree
Showing 3 changed files with 558 additions and 44 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ release.
route is not available).
Changes http client span names from `HTTP {http.method}` to `{http.method}`.
([#3165](https://github.com/open-telemetry/opentelemetry-specification/pull/3165))
- Mark `http.server.duration` and `http.client.duration` metrics as required, and mark
all other HTTP metrics as optional.
[#3158](https://github.com/open-telemetry/opentelemetry-specification/pull/3158)
- Add `net.host.port` to `http.server.active_requests` metrics attributes.
[#3158](https://github.com/open-telemetry/opentelemetry-specification/pull/3158)

### Compatibility

Expand Down
283 changes: 283 additions & 0 deletions semantic_conventions/metrics/http.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,283 @@
groups:
- id: metric.http.server.duration
type: metric
metric_name: http.server.duration
brief: "Measures the duration of inbound HTTP requests."
instrument: histogram
unit: "ms"
attributes:
- ref: http.method
requirement_level: required
- ref: http.scheme
requirement_level: required
- ref: http.route
requirement_level:
conditionally_required: If and only if it's available
- ref: http.status_code
requirement_level:
conditionally_required: If and only if one was received/sent.
- ref: http.flavor
- ref: net.host.name
requirement_level: required
brief: >
Name of the local HTTP server that received the request.
note: |
Determined by using the first of the following that applies
- The [primary server name](../../trace/semantic_conventions/http.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.
- ref: net.host.port
requirement_level:
conditionally_required: If not default (`80` for `http` scheme, `443` for `https`).
brief: >
Port of the local HTTP server that received the request.
note: |
Determined by using the first of the following that applies
- Port identifier of the [primary server host](../../trace/semantic_conventions/http.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
- id: metric.http.server.active_requests
type: metric
metric_name: http.server.active_requests
brief: "Measures the number of concurrent HTTP requests that are currently in-flight."
instrument: updowncounter
unit: "{requests}"
attributes:
- ref: http.method
requirement_level: required
- ref: http.scheme
requirement_level: required
- ref: http.flavor
- ref: net.host.name
requirement_level: required
brief: >
Name of the local HTTP server that received the request.
note: |
Determined by using the first of the following that applies
- The [primary server name](../../trace/semantic_conventions/http.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.
- ref: net.host.port
requirement_level:
conditionally_required: If not default (`80` for `http` scheme, `443` for `https`).
brief: >
Port of the local HTTP server that received the request.
note: |
Determined by using the first of the following that applies
- Port identifier of the [primary server host](../../trace/semantic_conventions/http.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
- id: metric.http.server.request.size
type: metric
metric_name: http.server.request.size
brief: "Measures the size of HTTP request messages (compressed)."
instrument: histogram
unit: "By"
# TODO (trask) below attributes are identical to above in metric.http.server.duration
attributes:
- ref: http.method
requirement_level: required
- ref: http.scheme
requirement_level: required
- ref: http.route
requirement_level:
conditionally_required: If and only if it's available
- ref: http.status_code
requirement_level:
conditionally_required: If and only if one was received/sent.
- ref: http.flavor
- ref: net.host.name
requirement_level: required
brief: >
Name of the local HTTP server that received the request.
note: |
Determined by using the first of the following that applies
- The [primary server name](../../trace/semantic_conventions/http.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.
- ref: net.host.port
requirement_level:
conditionally_required: If not default (`80` for `http` scheme, `443` for `https`).
brief: >
Port of the local HTTP server that received the request.
note: |
Determined by using the first of the following that applies
- Port identifier of the [primary server host](../../trace/semantic_conventions/http.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
- id: metric.http.server.response.size
type: metric
metric_name: http.server.response.size
brief: "Measures the size of HTTP response messages (compressed)."
instrument: histogram
unit: "By"
# TODO (trask) below attributes are identical to above in metric.http.server.duration
attributes:
- ref: http.method
requirement_level: required
- ref: http.scheme
requirement_level: required
- ref: http.route
requirement_level:
conditionally_required: If and only if it's available
- ref: http.status_code
requirement_level:
conditionally_required: If and only if one was received/sent.
- ref: http.flavor
- ref: net.host.name
requirement_level: required
brief: >
Name of the local HTTP server that received the request.
note: |
Determined by using the first of the following that applies
- The [primary server name](../../trace/semantic_conventions/http.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.
- ref: net.host.port
requirement_level:
conditionally_required: If not default (`80` for `http` scheme, `443` for `https`).
brief: >
Port of the local HTTP server that received the request.
note: |
Determined by using the first of the following that applies
- Port identifier of the [primary server host](../../trace/semantic_conventions/http.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
- id: metric.http.client.duration
type: metric
metric_name: http.client.duration
brief: "Measures the duration of outbound HTTP requests."
instrument: histogram
unit: "ms"
attributes:
- ref: http.method
requirement_level: required
- ref: http.status_code
requirement_level:
conditionally_required: If and only if one was received/sent.
- ref: http.flavor
- ref: net.peer.name
requirement_level: required
brief: >
Host identifier of the ["URI origin"](https://www.rfc-editor.org/rfc/rfc9110.html#name-uri-origin) HTTP request is sent to.
note: |
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.
- ref: net.peer.port
requirement_level:
conditionally_required: If not default (`80` for `http` scheme, `443` for `https`).
brief: >
Port identifier of the ["URI origin"](https://www.rfc-editor.org/rfc/rfc9110.html#name-uri-origin) HTTP request is sent to.
note: >
When [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) is absolute URI, `net.peer.name` MUST match
URI port identifier, otherwise it MUST match `Host` header port identifier.
- ref: net.sock.peer.addr

- id: metric.http.client.request.size
type: metric
metric_name: http.client.request.size
brief: "Measures the size of HTTP request messages (compressed)."
instrument: histogram
unit: "By"
# TODO (trask) below attributes are identical to above in metric.http.client.duration
attributes:
- ref: http.method
requirement_level: required
- ref: http.status_code
requirement_level:
conditionally_required: If and only if one was received/sent.
- ref: http.flavor
- ref: net.peer.name
requirement_level: required
brief: >
Host identifier of the ["URI origin"](https://www.rfc-editor.org/rfc/rfc9110.html#name-uri-origin) HTTP request is sent to.
note: |
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.
- ref: net.peer.port
requirement_level:
conditionally_required: If not default (`80` for `http` scheme, `443` for `https`).
brief: >
Port identifier of the ["URI origin"](https://www.rfc-editor.org/rfc/rfc9110.html#name-uri-origin) HTTP request is sent to.
note: >
When [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) is absolute URI, `net.peer.name` MUST match
URI port identifier, otherwise it MUST match `Host` header port identifier.
- ref: net.sock.peer.addr

- id: metric.http.client.response.size
type: metric
metric_name: http.client.response.size
brief: "Measures the size of HTTP response messages (compressed)."
instrument: histogram
unit: "By"
# TODO (trask) below attributes are identical to above in metric.http.client.duration
attributes:
- ref: http.method
requirement_level: required
- ref: http.status_code
requirement_level:
conditionally_required: If and only if one was received/sent.
- ref: http.flavor
- ref: net.peer.name
requirement_level: required
brief: >
Host identifier of the ["URI origin"](https://www.rfc-editor.org/rfc/rfc9110.html#name-uri-origin) HTTP request is sent to.
note: |
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.
- ref: net.peer.port
requirement_level:
conditionally_required: If not default (`80` for `http` scheme, `443` for `https`).
brief: >
Port identifier of the ["URI origin"](https://www.rfc-editor.org/rfc/rfc9110.html#name-uri-origin) HTTP request is sent to.
note: >
When [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource) is absolute URI, `net.peer.name` MUST match
URI port identifier, otherwise it MUST match `Host` header port identifier.
- ref: net.sock.peer.addr
Loading

0 comments on commit 1002125

Please sign in to comment.