Skip to content

Commit 242268e

Browse files
authored
Add cardinality warning about two opt-in HTTP metric attributes to all HTTP metrics. (open-telemetry#412)
1 parent 7680dc8 commit 242268e

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ release.
2727
([#401](https://github.com/open-telemetry/semantic-conventions/pull/401))
2828
- Change `server.port` from recommended to conditionally required on HTTP server semconv.
2929
([#399](https://github.com/open-telemetry/semantic-conventions/pull/399))
30+
- Add cardinality warning about two opt-in HTTP metric attributes to all HTTP metrics.
31+
([#412](https://github.com/open-telemetry/semantic-conventions/pull/412))
3032

3133
## v1.22.0 (2023-10-12)
3234

docs/http/http-metrics.md

+18
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,19 @@ SHOULD include the [application root](/docs/http/http-spans.md#http-server-defin
135135

136136
SHOULD NOT be set if only IP address is available and capturing name would require a reverse DNS lookup.
137137

138+
Warning: since this attribute may be based on the `Host` header, opting in to it may allow an attacker
139+
to trigger cardinality limits, degrading the usefulness of the metric.
140+
138141
**[7]:** Determined by using the first of the following that applies
139142

140143
- Port identifier of the [primary server host](/docs/http/http-spans.md#http-server-definitions) of the matched virtual host.
141144
- Port identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource)
142145
if it's sent in absolute-form.
143146
- Port identifier of the `Host` header
144147

148+
Warning: since this attribute may be based on the `Host` header, opting in to it may allow an attacker
149+
to trigger cardinality limits, degrading the usefulness of the metric.
150+
145151
**[8]:** The scheme of the original client request, if known (e.g. from [Forwarded](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded), [X-Forwarded-Proto](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto), or a similar header). Otherwise, the scheme of the immediate peer request.
146152

147153
`error.type` 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.
@@ -316,13 +322,19 @@ SHOULD include the [application root](/docs/http/http-spans.md#http-server-defin
316322

317323
SHOULD NOT be set if only IP address is available and capturing name would require a reverse DNS lookup.
318324

325+
Warning: since this attribute may be based on the `Host` header, opting in to it may allow an attacker
326+
to trigger cardinality limits, degrading the usefulness of the metric.
327+
319328
**[7]:** Determined by using the first of the following that applies
320329

321330
- Port identifier of the [primary server host](/docs/http/http-spans.md#http-server-definitions) of the matched virtual host.
322331
- Port identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource)
323332
if it's sent in absolute-form.
324333
- Port identifier of the `Host` header
325334

335+
Warning: since this attribute may be based on the `Host` header, opting in to it may allow an attacker
336+
to trigger cardinality limits, degrading the usefulness of the metric.
337+
326338
**[8]:** The scheme of the original client request, if known (e.g. from [Forwarded](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded), [X-Forwarded-Proto](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto), or a similar header). Otherwise, the scheme of the immediate peer request.
327339

328340
`error.type` 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.
@@ -423,13 +435,19 @@ SHOULD include the [application root](/docs/http/http-spans.md#http-server-defin
423435

424436
SHOULD NOT be set if only IP address is available and capturing name would require a reverse DNS lookup.
425437

438+
Warning: since this attribute may be based on the `Host` header, opting in to it may allow an attacker
439+
to trigger cardinality limits, degrading the usefulness of the metric.
440+
426441
**[7]:** Determined by using the first of the following that applies
427442

428443
- Port identifier of the [primary server host](/docs/http/http-spans.md#http-server-definitions) of the matched virtual host.
429444
- Port identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource)
430445
if it's sent in absolute-form.
431446
- Port identifier of the `Host` header
432447

448+
Warning: since this attribute may be based on the `Host` header, opting in to it may allow an attacker
449+
to trigger cardinality limits, degrading the usefulness of the metric.
450+
433451
**[8]:** The scheme of the original client request, if known (e.g. from [Forwarded](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded), [X-Forwarded-Proto](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto), or a similar header). Otherwise, the scheme of the immediate peer request.
434452

435453
`error.type` 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.

model/metrics/http.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,32 @@ groups:
66
attributes:
77
- ref: server.address
88
requirement_level: opt_in
9+
note: |
10+
Determined by using the first of the following that applies
11+
12+
- The [primary server name](/docs/http/http-spans.md#http-server-definitions) of the matched virtual host. MUST only
13+
include host identifier.
14+
- Host identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource)
15+
if it's sent in absolute-form.
16+
- Host identifier of the `Host` header
17+
18+
SHOULD NOT be set if only IP address is available and capturing name would require a reverse DNS lookup.
19+
20+
Warning: since this attribute may be based on the `Host` header, opting in to it may allow an attacker
21+
to trigger cardinality limits, degrading the usefulness of the metric.
22+
923
- ref: server.port
1024
requirement_level: opt_in
25+
note: |
26+
Determined by using the first of the following that applies
27+
28+
- Port identifier of the [primary server host](/docs/http/http-spans.md#http-server-definitions) of the matched virtual host.
29+
- Port identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource)
30+
if it's sent in absolute-form.
31+
- Port identifier of the `Host` header
32+
33+
Warning: since this attribute may be based on the `Host` header, opting in to it may allow an attacker
34+
to trigger cardinality limits, degrading the usefulness of the metric.
1135
1236
- id: metric_attributes.http.client
1337
type: attribute_group

0 commit comments

Comments
 (0)