Skip to content

Commit

Permalink
Add metric for currently-in-flight HTTP requests (open-telemetry#1378)
Browse files Browse the repository at this point in the history
* Add metric for currently-in-flight HTTP requests

* Update name to active_requests

* Fix missing rename noticed by anuraaga

* Clarify `active_requests` are in-flight

Co-authored-by: Reiley Yang <[email protected]>

* Switch to UpDownSumObserver

Co-authored-by: Reiley Yang <[email protected]>
Co-authored-by: Joshua MacDonald <[email protected]>
  • Loading branch information
3 people authored Mar 16, 2021
1 parent d476182 commit 2484886
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ New:

Updates:

- Add `http.server.active_requests` to count in-flight HTTP requests
([#1378](https://github.com/open-telemetry/opentelemetry-specification/pull/1378))
- Update default limit for span attributes, events, links to 128([#1419](https://github.com/open-telemetry/opentelemetry-specification/pull/1419))
- Update OT Trace propagator environment variable to match latest name([#1406](https://github.com/open-telemetry/opentelemetry-specification/pull/1406))
- Remove Metrics SDK specification to avoid confusion, clarify that Metrics API
Expand Down
19 changes: 15 additions & 4 deletions specification/metrics/semantic_conventions/http-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ type and units.

Below is a table of HTTP server metric instruments.

| Name | Instrument | Units | Description |
|------------------------|---------------|--------------|-------------|
| `http.server.duration` | ValueRecorder | milliseconds | measures the duration of the inbound HTTP request |
| Name | Instrument | Units | Description |
|-------------------------------|-------------------|--------------|-------------|
| `http.server.duration` | ValueRecorder | milliseconds | measures the duration of the inbound HTTP request |
| `http.server.active_requests` | UpDownSumObserver | requests | measures the number of concurrent HTTP requests that are currently in-flight |

### HTTP Client

Expand All @@ -31,7 +32,7 @@ Below is a table of HTTP client metric instruments.

## Labels

Below is a table of the labels that SHOULD be included on metric events
Below is a table of the labels that SHOULD be included on `duration` metric events
and whether they should be on server, client, or both types of HTTP metric events:

| Name | Type | Recommended | Notes and examples |
Expand All @@ -48,6 +49,16 @@ and whether they should be on server, client, or both types of HTTP metric event
| `net.host.name` | `server` | see [2] in [label alternatives](#label-alternatives) | See [general network connection attributes](../../trace/semantic_conventions/span-general.md#general-network-connection-attributes) |
| `net.host.port` | `server` | see [2] in [label alternatives](#label-alternatives) | See [general network connection attributes](../../trace/semantic_conventions/span-general.md#general-network-connection-attributes) |

The following labels SHOULD be included in the `http.server.active_requests` observation:

| Name | Recommended | Notes and examples |
|--------------------|-------------|--------------------|
| `http.method` | Yes | The HTTP request method. E.g. `"GET"` |
| `http.host` | see [label alternatives](#label-alternatives) | The value of the [HTTP host header][]. When the header is empty or not present, this label should be the same |
| `http.scheme` | see [label alternatives](#label-alternatives) | The URI scheme identifying the used protocol in lowercase: `"http"` or `"https"` |
| `http.flavor` | Optional | Kind of HTTP protocol used: `"1.0"`, `"1.1"`, `"2"`, `"SPDY"` or `"QUIC"` |
| `http.server_name` | see [2] in [label alternatives](#label-alternatives) | The primary server name of the matched virtual host. This should be obtained via configuration. If no such configuration can be obtained, this label MUST NOT be set ( `net.host.name` should be used instead). |

[HTTP host header]: https://tools.ietf.org/html/rfc7230#section-5.4
[HTTP response status code]: https://tools.ietf.org/html/rfc7231#section-6
[HTTP reason phrase]: https://tools.ietf.org/html/rfc7230#section-3.1.2
Expand Down

0 comments on commit 2484886

Please sign in to comment.