Skip to content

Commit

Permalink
Http route should contain application root (#3164)
Browse files Browse the repository at this point in the history
  • Loading branch information
trask authored Feb 6, 2023
1 parent 1002125 commit f6a15a7
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ release.
[#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)
- `http.route` SHOULD contain the "application root" if there is one.
([#3164](https://github.com/open-telemetry/opentelemetry-specification/pull/3164))

### Compatibility

Expand Down
21 changes: 21 additions & 0 deletions semantic_conventions/metrics/http.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ groups:
- ref: http.route
requirement_level:
conditionally_required: If and only if it's available
brief: >
The matched route (path template in the format used by the respective server framework). See note below
examples: ['/users/:userID?', '{controller}/{action}/{id?}']
note: >
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](../../trace/semantic_conventions/http.md#http-server-definitions) if there is one.
- ref: http.status_code
requirement_level:
conditionally_required: If and only if one was received/sent.
Expand Down Expand Up @@ -98,6 +105,13 @@ groups:
- ref: http.route
requirement_level:
conditionally_required: If and only if it's available
brief: >
The matched route (path template in the format used by the respective server framework). See note below
examples: ['/users/:userID?', '{controller}/{action}/{id?}']
note: >
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](../../trace/semantic_conventions/http.md#http-server-definitions) if there is one.
- ref: http.status_code
requirement_level:
conditionally_required: If and only if one was received/sent.
Expand Down Expand Up @@ -144,6 +158,13 @@ groups:
- ref: http.route
requirement_level:
conditionally_required: If and only if it's available
brief: >
The matched route (path template in the format used by the respective server framework). See note below
examples: ['/users/:userID?', '{controller}/{action}/{id?}']
note: >
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](../../trace/semantic_conventions/http.md#http-server-definitions) if there is one.
- ref: http.status_code
requirement_level:
conditionally_required: If and only if one was received/sent.
Expand Down
4 changes: 3 additions & 1 deletion semantic_conventions/trace/http.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ groups:
The matched route (path template in the format used by the respective server framework). See note below
examples: ['/users/:userID?', '{controller}/{action}/{id?}']
note: >
'http.route' 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.
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](#http-server-definitions) if there is one.
- id: client_ip
type: string
brief: >
Expand Down
9 changes: 6 additions & 3 deletions specification/metrics/semantic_conventions/http-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ This metric is required.

**[1]:** If `net.transport` is not specified, it can be assumed to be `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed.

**[2]:** 'http.route' 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.
**[2]:** 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](../../trace/semantic_conventions/http.md#http-server-definitions) if there is one.

**[3]:** Determined by using the first of the following that applies

Expand Down Expand Up @@ -123,7 +124,8 @@ This metric is optional.

**[1]:** If `net.transport` is not specified, it can be assumed to be `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed.

**[2]:** 'http.route' 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.
**[2]:** 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](../../trace/semantic_conventions/http.md#http-server-definitions) if there is one.

**[3]:** Determined by using the first of the following that applies

Expand Down Expand Up @@ -168,7 +170,8 @@ This metric is optional.

**[1]:** If `net.transport` is not specified, it can be assumed to be `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed.

**[2]:** 'http.route' 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.
**[2]:** 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](../../trace/semantic_conventions/http.md#http-server-definitions) if there is one.

**[3]:** Determined by using the first of the following that applies

Expand Down
7 changes: 4 additions & 3 deletions specification/trace/semantic_conventions/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ Within a single virtual host, some servers support the concepts of an **HTTP app
in a deployment of a Python application to Apache, the application would be the [PEP 3333][] conformant callable that is configured using the
[`WSGIScriptAlias` directive][modwsgisetup] of `mod_wsgi`).

An application can be "mounted" under some **application root**
(also know as *[context root][]* *[context prefix][]*, or *[document base][]*)
An application can be "mounted" under an **application root**
(also known as a *[context root][]*, *[context prefix][]*, or *[document base][]*)
which is a fixed path prefix of the URL that determines to which application a request is routed
(e.g., the server could be configured to route all requests that go to an URL path starting with `/webshop/`
at a particular virtual host
Expand Down Expand Up @@ -245,7 +245,8 @@ If the route cannot be determined, the `name` attribute MUST be set as defined i
| [`net.sock.host.addr`](span-general.md) | string | Local socket address. Useful in case of a multi-IP host. | `192.168.0.1` | Optional |
| [`net.sock.host.port`](span-general.md) | int | Local socket port number. | `35555` | Recommended: [6] |

**[1]:** 'http.route' 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.
**[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](#http-server-definitions) if there is one.

**[2]:** This is not necessarily the same as `net.sock.peer.addr`, which would
identify the network-level peer, which may be a proxy.
Expand Down

0 comments on commit f6a15a7

Please sign in to comment.