Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add http metrics yaml #3158

Merged
merged 6 commits into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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