Skip to content

Commit 614dbef

Browse files
authored
BREAKING: Introduce common url.* attributes, and improve use of namespacing under http.* (open-telemetry#3355)
1 parent 9e3e528 commit 614dbef

File tree

9 files changed

+192
-103
lines changed

9 files changed

+192
-103
lines changed

schemas/1.21.0

+9
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ versions:
3636
net.host.carrier.mcc: network.carrier.mcc
3737
net.host.carrier.mnc: network.carrier.mnc
3838
net.host.carrier.icc: network.carrier.icc
39+
# https://github.com/open-telemetry/opentelemetry-specification/pull/3355
40+
- rename_attributes:
41+
attribute_map:
42+
http.method: http.request.method
43+
http.status_code: http.response.status_code
44+
http.scheme: url.scheme
45+
http.url: url.full
46+
http.request_content_length: http.request.body.size
47+
http.response_content_length: http.response.body.size
3948
1.20.0:
4049
spans:
4150
changes:
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
groups:
2+
- id: attributes.http.deprecated
3+
type: attribute_group
4+
brief: "Describes deprecated HTTP attributes."
5+
prefix: http
6+
attributes:
7+
- id: method
8+
type: string
9+
brief: 'Deprecated, use `http.request.method` instead.'
10+
stability: deprecated
11+
examples: ["GET", "POST", "HEAD"]
12+
- id: status_code
13+
type: int
14+
brief: 'Deprecated, use `http.response.status_code` instead.'
15+
stability: deprecated
16+
examples: [200]
17+
- id: scheme
18+
type: string
19+
brief: 'Deprecated, use `url.scheme` instead.'
20+
stability: deprecated
21+
examples: ['http', 'https']
22+
- id: url
23+
type: string
24+
brief: 'Deprecated, use `url.full` instead.'
25+
stability: deprecated
26+
examples: ['https://www.foo.bar/search?q=OpenTelemetry#SemConv']
27+
- id: target
28+
type: string
29+
brief: 'Deprecated, use `url.path` and `url.query` instead.'
30+
stability: deprecated
31+
examples: ['/search?q=OpenTelemetry#SemConv']
32+
- id: request_content_length
33+
type: int
34+
brief: 'Deprecated, use `http.request.body.size` instead.'
35+
stability: deprecated
36+
examples: 3495
37+
- id: response_content_length
38+
type: int
39+
brief: 'Deprecated, use `http.response.body.size` instead.'
40+
stability: deprecated
41+
examples: 3495

semantic_conventions/http-common.yaml

+5-7
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ groups:
44
brief: "Describes HTTP attributes."
55
prefix: http
66
attributes:
7-
- id: method
7+
- id: request.method
88
type: string
99
requirement_level: required
1010
brief: 'HTTP request method.'
1111
examples: ["GET", "POST", "HEAD"]
12-
- id: status_code
12+
- id: response.status_code
1313
type: int
1414
requirement_level:
1515
conditionally_required: If and only if one was received/sent.
@@ -53,11 +53,6 @@ groups:
5353
type: attribute_group
5454
brief: 'HTTP Server spans attributes'
5555
attributes:
56-
- id: scheme
57-
type: string
58-
brief: 'The URI scheme identifying the used protocol.'
59-
requirement_level: required
60-
examples: ["http", "https"]
6156
- id: route
6257
type: string
6358
requirement_level:
@@ -96,3 +91,6 @@ groups:
9691
- Port identifier of the [request target](https://www.rfc-editor.org/rfc/rfc9110.html#target.resource)
9792
if it's sent in absolute-form.
9893
- Port identifier of the `Host` header
94+
- ref: url.scheme
95+
requirement_level: required
96+
examples: ["http", "https"]

semantic_conventions/metrics/http.yaml

+16-15
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ groups:
88
extends: attributes.http.server
99
attributes:
1010
# todo (lmolkova) build tools don't populate grandparent attributes
11-
- ref: http.method
12-
- ref: http.status_code
11+
- ref: http.request.method
12+
- ref: http.response.status_code
1313
- ref: network.protocol.name
1414
- ref: network.protocol.version
1515

@@ -20,8 +20,10 @@ groups:
2020
instrument: updowncounter
2121
unit: "{request}"
2222
attributes:
23-
- ref: http.method
24-
- ref: http.scheme
23+
- ref: http.request.method
24+
- ref: url.scheme
25+
requirement_level: required
26+
examples: ["http", "https"]
2527
- ref: server.address
2628
requirement_level: required
2729
brief: >
@@ -60,8 +62,8 @@ groups:
6062
# TODO (trask) below attributes are identical to above in metric.http.server.duration
6163
attributes:
6264
# todo (lmolkova) build tools don't populate grandparent attributes
63-
- ref: http.method
64-
- ref: http.status_code
65+
- ref: http.request.method
66+
- ref: http.response.status_code
6567
- ref: network.protocol.name
6668
- ref: network.protocol.version
6769

@@ -74,8 +76,8 @@ groups:
7476
extends: attributes.http.server
7577
# TODO (trask) below attributes are identical to above in metric.http.server.duration
7678
attributes:
77-
- ref: http.method
78-
- ref: http.status_code
79+
- ref: http.request.method
80+
- ref: http.response.status_code
7981
- ref: network.protocol.name
8082
- ref: network.protocol.version
8183

@@ -87,12 +89,11 @@ groups:
8789
unit: "s"
8890
extends: attributes.http.client
8991
attributes:
90-
- ref: http.method
91-
- ref: http.status_code
92+
- ref: http.request.method
93+
- ref: http.response.status_code
9294
- ref: network.protocol.name
9395
- ref: network.protocol.version
9496
- ref: server.socket.address
95-
9697
- id: metric.http.client.request.size
9798
type: metric
9899
metric_name: http.client.request.size
@@ -102,8 +103,8 @@ groups:
102103
extends: attributes.http.client
103104
# TODO (trask) below attributes are identical to above in metric.http.client.duration
104105
attributes:
105-
- ref: http.method
106-
- ref: http.status_code
106+
- ref: http.request.method
107+
- ref: http.response.status_code
107108
- ref: network.protocol.name
108109
- ref: network.protocol.version
109110
- ref: server.socket.address
@@ -117,8 +118,8 @@ groups:
117118
extends: attributes.http.client
118119
# TODO (trask) below attributes are identical to above in metric.http.client.duration
119120
attributes:
120-
- ref: http.method
121-
- ref: http.status_code
121+
- ref: http.request.method
122+
- ref: http.response.status_code
122123
- ref: network.protocol.name
123124
- ref: network.protocol.version
124125
- ref: server.socket.address

semantic_conventions/trace/http.yaml

+16-22
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ groups:
88
These conventions can be used for http and https schemes
99
and various HTTP versions like 1.1, 2 and SPDY.
1010
attributes:
11-
- id: request_content_length
11+
- id: request.body.size
1212
type: int
1313
brief: >
1414
The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and
1515
is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length)
1616
header. For requests using transport encoding, this should be the compressed size.
1717
examples: 3495
18-
- id: response_content_length
18+
- id: response.body.size
1919
type: int
2020
brief: >
2121
The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and
2222
is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length)
2323
header. For requests using transport encoding, this should be the compressed size.
2424
examples: 3495
25-
- ref: http.method
25+
- ref: http.request.method
2626
sampling_relevant: true
2727
- ref: network.transport
2828
requirement_level:
@@ -37,17 +37,6 @@ groups:
3737
span_kind: client
3838
brief: 'Semantic Convention for HTTP Client'
3939
attributes:
40-
- id: url
41-
type: string
42-
requirement_level: required
43-
brief: >
44-
Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`.
45-
Usually the fragment is not transmitted over HTTP, but if it is known, it should be included nevertheless.
46-
note: >
47-
`http.url` MUST NOT contain credentials passed via URL in form of `https://username:[email protected]/`.
48-
In such case the attribute's value should be `https://www.example.com/`.
49-
sampling_relevant: true
50-
examples: ['https://www.foo.bar/search?q=OpenTelemetry#SemConv']
5140
- id: resend_count
5241
type: int
5342
brief: >
@@ -85,6 +74,10 @@ groups:
8574
- ref: server.socket.domain
8675
- ref: server.socket.address
8776
- ref: server.socket.port
77+
- ref: url.full
78+
sampling_relevant: true
79+
requirement_level: required
80+
8881

8982
- id: trace.http.server
9083
prefix: http
@@ -93,14 +86,6 @@ groups:
9386
span_kind: server
9487
brief: 'Semantic Convention for HTTP Server'
9588
attributes:
96-
- id: target
97-
type: string
98-
brief: 'The full request target as passed in a HTTP request line or equivalent.'
99-
requirement_level: required
100-
sampling_relevant: true
101-
examples: ['/users/12314/?q=ddds']
102-
- ref: http.scheme
103-
sampling_relevant: true
10489
- ref: server.address
10590
requirement_level: required
10691
sampling_relevant: true
@@ -149,3 +134,12 @@ groups:
149134
Otherwise, the immediate client peer port.
150135
- ref: client.socket.address
151136
- ref: client.socket.port
137+
- ref: url.path
138+
requirement_level: required
139+
sampling_relevant: true
140+
- ref: url.query
141+
sampling_relevant: true
142+
- ref: url.scheme
143+
sampling_relevant: true
144+
requirement_level: required
145+
examples: ["http", "https"]

semantic_conventions/url.yaml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
groups:
2+
- id: url
3+
brief: Attributes describing URL.
4+
type: attribute_group
5+
prefix: url
6+
attributes:
7+
- id: scheme
8+
type: string
9+
brief: 'The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol.'
10+
examples: ["https", "ftp", "telnet"]
11+
- id: full
12+
type: string
13+
brief: Absolute URL describing a network resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986)
14+
note: >
15+
For network calls, URL usually has `scheme://host[:port][path][?query][#fragment]` format, where the fragment
16+
is not transmitted over HTTP, but if it is known, it should be included nevertheless.
17+
18+
`url.full` MUST NOT contain credentials passed via URL in form of `https://username:[email protected]/`.
19+
In such case username and password should be redacted and attribute's value should be `https://REDACTED:[email protected]/`.
20+
21+
`url.full` SHOULD capture the absolute URL when it is available (or can be reconstructed)
22+
and SHOULD NOT be validated or modified except for sanitizing purposes.
23+
examples: ['https://www.foo.bar/search?q=OpenTelemetry#SemConv', '//localhost']
24+
tag: sensitive-information
25+
- id: path
26+
type: string
27+
brief: 'The [URI path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component'
28+
examples: ['/search']
29+
note: When missing, the value is assumed to be `/`
30+
- id: query
31+
type: string
32+
brief: 'The [URI query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component'
33+
examples: ["q=OpenTelemetry"]
34+
note: Sensitive content provided in query string SHOULD be scrubbed when instrumentations can identify it.
35+
tag: sensitive-information
36+
- id: fragment
37+
type: string
38+
brief: 'The [URI fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component'
39+
examples: ["SemConv"]

0 commit comments

Comments
 (0)