Skip to content

Commit 495d705

Browse files
authored
Update semconv to 1.21.0 (#3251)
1 parent c8e5c3e commit 495d705

File tree

12 files changed

+2202
-517
lines changed

12 files changed

+2202
-517
lines changed

.codespellrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[codespell]
22
# skipping auto generated folders
3-
skip = ./.tox,./.mypy_cache,./docs/_build,./target,*/LICENSE,./venv,.git
3+
skip = ./.tox,./.mypy_cache,./docs/_build,./target,*/LICENSE,./venv,.git,./opentelemetry-semantic-conventions
44
ignore-words-list = ans,ue,ot,hist,ro

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ jobs:
119119

120120
# Contrib unit test suite in order to ensure changes in core do not break anything in contrib.
121121
# We only run contrib unit tests on the oldest supported Python version (3.7) as running the same tests
122-
# on all versions is somewhat redundant.
122+
# on all versions is somewhat redundant.
123123
contrib-build:
124124
env:
125125
# We use these variables to convert between tox and GHA version literals

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,6 @@ target
6363
# Django example
6464

6565
docs/examples/django/db.sqlite3
66+
67+
# Semantic conventions
68+
scripts/semconv/semantic-conventions

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
([#3442](https://github.com/open-telemetry/opentelemetry-python/pull/3442))
1818
- Do not load Resource on sdk import
1919
([#3447](https://github.com/open-telemetry/opentelemetry-python/pull/3447))
20+
- Update semantic conventions to version 1.21.0
21+
([#3251](https://github.com/open-telemetry/opentelemetry-python/pull/3251))
2022

2123
## Version 1.20.0/0.41b0 (2023-09-04)
2224

@@ -29,7 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2931
([#3372](https://github.com/open-telemetry/opentelemetry-python/pull/3372))
3032
- Update the body type in the log
3133
([$3343](https://github.com/open-telemetry/opentelemetry-python/pull/3343))
32-
- Add max_scale option to Exponential Bucket Histogram Aggregation
34+
- Add max_scale option to Exponential Bucket Histogram Aggregation
3335
([#3323](https://github.com/open-telemetry/opentelemetry-python/pull/3323))
3436
- Use BoundedAttributes instead of raw dict to extract attributes from LogRecord
3537
([#3310](https://github.com/open-telemetry/opentelemetry-python/pull/3310))

docs/examples/django/README.rst

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,14 @@ output similar to this one:
8484
"status_code": "OK"
8585
},
8686
"attributes": {
87-
"http.method": "GET",
88-
"http.server_name": "localhost",
89-
"http.scheme": "http",
90-
"host.port": 8000,
91-
"http.host": "localhost:8000",
92-
"http.url": "http://localhost:8000/?param=hello",
93-
"net.peer.ip": "127.0.0.1",
94-
"http.flavor": "1.1",
95-
"http.status_text": "OK",
96-
"http.status_code": 200
87+
"http.request.method": "GET",
88+
"server.address": "localhost",
89+
"url.scheme": "http",
90+
"server.port": 8000,
91+
"url.full": "http://localhost:8000/?param=hello",
92+
"server.socket.address": "127.0.0.1",
93+
"network.protocol.version": "1.1",
94+
"http.response.status_code": 200
9795
},
9896
"events": [],
9997
"links": []

opentelemetry-sdk/tests/trace/test_trace.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -640,12 +640,12 @@ def test_attributes(self):
640640
with self.tracer.start_as_current_span("root") as root:
641641
root.set_attributes(
642642
{
643-
"http.method": "GET",
644-
"http.url": "https://example.com:779/path/12/?q=d#123",
643+
"http.request.method": "GET",
644+
"url.full": "https://example.com:779/path/12/?q=d#123",
645645
}
646646
)
647647

648-
root.set_attribute("http.status_code", 200)
648+
root.set_attribute("http.response.status_code", 200)
649649
root.set_attribute("http.status_text", "OK")
650650
root.set_attribute("misc.pi", 3.14)
651651

@@ -661,12 +661,12 @@ def test_attributes(self):
661661
root.set_attribute("list-of-numerics", list_of_numerics)
662662

663663
self.assertEqual(len(root.attributes), 9)
664-
self.assertEqual(root.attributes["http.method"], "GET")
664+
self.assertEqual(root.attributes["http.request.method"], "GET")
665665
self.assertEqual(
666-
root.attributes["http.url"],
666+
root.attributes["url.full"],
667667
"https://example.com:779/path/12/?q=d#123",
668668
)
669-
self.assertEqual(root.attributes["http.status_code"], 200)
669+
self.assertEqual(root.attributes["http.response.status_code"], 200)
670670
self.assertEqual(root.attributes["http.status_text"], "OK")
671671
self.assertEqual(root.attributes["misc.pi"], 3.14)
672672
self.assertEqual(root.attributes["attr-key"], "attr-value2")
@@ -1007,7 +1007,7 @@ def test_ended_span(self):
10071007
self.assertEqual(end_time0, root.end_time)
10081008

10091009
with self.assertLogs(level=WARNING):
1010-
root.set_attribute("http.method", "GET")
1010+
root.set_attribute("http.request.method", "GET")
10111011
self.assertEqual(len(root.attributes), 0)
10121012

10131013
with self.assertLogs(level=WARNING):

opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py

Lines changed: 181 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,200 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# pylint: disable=too-many-lines
16-
1715

1816
class MetricInstruments:
17+
SCHEMA_URL = "https://opentelemetry.io/schemas/v1.21.0"
18+
"""
19+
The URL of the OpenTelemetry schema for these keys and values.
20+
"""
1921

2022
HTTP_SERVER_DURATION = "http.server.duration"
23+
"""
24+
Measures the duration of inbound HTTP requests
25+
Instrument: histogram
26+
Unit: s
27+
"""
28+
29+
HTTP_SERVER_ACTIVE_REQUESTS = "http.server.active_requests"
30+
"""
31+
Measures the number of concurrent HTTP requests that are currently in-flight
32+
Instrument: updowncounter
33+
Unit: {request}
34+
"""
2135

2236
HTTP_SERVER_REQUEST_SIZE = "http.server.request.size"
37+
"""
38+
Measures the size of HTTP request messages (compressed)
39+
Instrument: histogram
40+
Unit: By
41+
"""
2342

2443
HTTP_SERVER_RESPONSE_SIZE = "http.server.response.size"
25-
26-
HTTP_SERVER_ACTIVE_REQUESTS = "http.server.active_requests"
44+
"""
45+
Measures the size of HTTP response messages (compressed)
46+
Instrument: histogram
47+
Unit: By
48+
"""
2749

2850
HTTP_CLIENT_DURATION = "http.client.duration"
51+
"""
52+
Measures the duration of outbound HTTP requests
53+
Instrument: histogram
54+
Unit: s
55+
"""
2956

3057
HTTP_CLIENT_REQUEST_SIZE = "http.client.request.size"
58+
"""
59+
Measures the size of HTTP request messages (compressed)
60+
Instrument: histogram
61+
Unit: By
62+
"""
3163

3264
HTTP_CLIENT_RESPONSE_SIZE = "http.client.response.size"
65+
"""
66+
Measures the size of HTTP response messages (compressed)
67+
Instrument: histogram
68+
Unit: By
69+
"""
70+
71+
PROCESS_RUNTIME_JVM_MEMORY_INIT = "process.runtime.jvm.memory.init"
72+
"""
73+
Measure of initial memory requested
74+
Instrument: updowncounter
75+
Unit: By
76+
"""
77+
78+
PROCESS_RUNTIME_JVM_SYSTEM_CPU_UTILIZATION = (
79+
"process.runtime.jvm.system.cpu.utilization"
80+
)
81+
"""
82+
Recent CPU utilization for the whole system as reported by the JVM
83+
Instrument: gauge
84+
Unit: 1
85+
"""
86+
87+
PROCESS_RUNTIME_JVM_SYSTEM_CPU_LOAD_1M = (
88+
"process.runtime.jvm.system.cpu.load_1m"
89+
)
90+
"""
91+
Average CPU load of the whole system for the last minute as reported by the JVM
92+
Instrument: gauge
93+
Unit: 1
94+
"""
95+
96+
PROCESS_RUNTIME_JVM_BUFFER_USAGE = "process.runtime.jvm.buffer.usage"
97+
"""
98+
Measure of memory used by buffers
99+
Instrument: updowncounter
100+
Unit: By
101+
"""
102+
103+
PROCESS_RUNTIME_JVM_BUFFER_LIMIT = "process.runtime.jvm.buffer.limit"
104+
"""
105+
Measure of total memory capacity of buffers
106+
Instrument: updowncounter
107+
Unit: By
108+
"""
109+
110+
PROCESS_RUNTIME_JVM_BUFFER_COUNT = "process.runtime.jvm.buffer.count"
111+
"""
112+
Number of buffers in the pool
113+
Instrument: updowncounter
114+
Unit: {buffer}
115+
"""
116+
117+
PROCESS_RUNTIME_JVM_MEMORY_USAGE = "process.runtime.jvm.memory.usage"
118+
"""
119+
Measure of memory used
120+
Instrument: updowncounter
121+
Unit: By
122+
"""
123+
124+
PROCESS_RUNTIME_JVM_MEMORY_COMMITTED = (
125+
"process.runtime.jvm.memory.committed"
126+
)
127+
"""
128+
Measure of memory committed
129+
Instrument: updowncounter
130+
Unit: By
131+
"""
132+
133+
PROCESS_RUNTIME_JVM_MEMORY_LIMIT = "process.runtime.jvm.memory.limit"
134+
"""
135+
Measure of max obtainable memory
136+
Instrument: updowncounter
137+
Unit: By
138+
"""
139+
140+
PROCESS_RUNTIME_JVM_MEMORY_USAGE_AFTER_LAST_GC = (
141+
"process.runtime.jvm.memory.usage_after_last_gc"
142+
)
143+
"""
144+
Measure of memory used, as measured after the most recent garbage collection event on this pool
145+
Instrument: updowncounter
146+
Unit: By
147+
"""
148+
149+
PROCESS_RUNTIME_JVM_GC_DURATION = "process.runtime.jvm.gc.duration"
150+
"""
151+
Duration of JVM garbage collection actions
152+
Instrument: histogram
153+
Unit: s
154+
"""
155+
156+
PROCESS_RUNTIME_JVM_THREADS_COUNT = "process.runtime.jvm.threads.count"
157+
"""
158+
Number of executing platform threads
159+
Instrument: updowncounter
160+
Unit: {thread}
161+
"""
162+
163+
PROCESS_RUNTIME_JVM_CLASSES_LOADED = "process.runtime.jvm.classes.loaded"
164+
"""
165+
Number of classes loaded since JVM start
166+
Instrument: counter
167+
Unit: {class}
168+
"""
169+
170+
PROCESS_RUNTIME_JVM_CLASSES_UNLOADED = (
171+
"process.runtime.jvm.classes.unloaded"
172+
)
173+
"""
174+
Number of classes unloaded since JVM start
175+
Instrument: counter
176+
Unit: {class}
177+
"""
178+
179+
PROCESS_RUNTIME_JVM_CLASSES_CURRENT_LOADED = (
180+
"process.runtime.jvm.classes.current_loaded"
181+
)
182+
"""
183+
Number of classes currently loaded
184+
Instrument: updowncounter
185+
Unit: {class}
186+
"""
187+
188+
PROCESS_RUNTIME_JVM_CPU_TIME = "process.runtime.jvm.cpu.time"
189+
"""
190+
CPU time used by the process as reported by the JVM
191+
Instrument: counter
192+
Unit: s
193+
"""
194+
195+
PROCESS_RUNTIME_JVM_CPU_RECENT_UTILIZATION = (
196+
"process.runtime.jvm.cpu.recent_utilization"
197+
)
198+
"""
199+
Recent CPU utilization for the process as reported by the JVM
200+
Instrument: gauge
201+
Unit: 1
202+
"""
203+
204+
# Manually defined metrics
33205

34206
DB_CLIENT_CONNECTIONS_USAGE = "db.client.connections.usage"
207+
"""
208+
The number of connections that are currently in state described by the `state` attribute
209+
Instrument: UpDownCounter
210+
Unit: {connection}
211+
"""

0 commit comments

Comments
 (0)