Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update semconv to 1.21.0 #3251

Merged
merged 22 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .codespellrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[codespell]
# skipping auto generated folders
skip = ./.tox,./.mypy_cache,./docs/_build,./target,*/LICENSE,./venv,.git
skip = ./.tox,./.mypy_cache,./docs/_build,./target,*/LICENSE,./venv,.git,./opentelemetry-semantic-conventions
ignore-words-list = ans,ue,ot,hist,ro
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:

# Contrib unit test suite in order to ensure changes in core do not break anything in contrib.
# We only run contrib unit tests on the oldest supported Python version (3.7) as running the same tests
# on all versions is somewhat redundant.
# on all versions is somewhat redundant.
contrib-build:
env:
# We use these variables to convert between tox and GHA version literals
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@ target
# Django example

docs/examples/django/db.sqlite3

# Semantic conventions
scripts/semconv/semantic-conventions
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#3442](https://github.com/open-telemetry/opentelemetry-python/pull/3442))
- Do not load Resource on sdk import
([#3447](https://github.com/open-telemetry/opentelemetry-python/pull/3447))
- Update semantic conventions to version 1.21.0
([#3251](https://github.com/open-telemetry/opentelemetry-python/pull/3251))

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

Expand All @@ -29,7 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#3372](https://github.com/open-telemetry/opentelemetry-python/pull/3372))
- Update the body type in the log
([$3343](https://github.com/open-telemetry/opentelemetry-python/pull/3343))
- Add max_scale option to Exponential Bucket Histogram Aggregation
- Add max_scale option to Exponential Bucket Histogram Aggregation
([#3323](https://github.com/open-telemetry/opentelemetry-python/pull/3323))
- Use BoundedAttributes instead of raw dict to extract attributes from LogRecord
([#3310](https://github.com/open-telemetry/opentelemetry-python/pull/3310))
Expand Down
18 changes: 8 additions & 10 deletions docs/examples/django/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,14 @@ output similar to this one:
"status_code": "OK"
},
"attributes": {
"http.method": "GET",
"http.server_name": "localhost",
"http.scheme": "http",
"host.port": 8000,
"http.host": "localhost:8000",
"http.url": "http://localhost:8000/?param=hello",
"net.peer.ip": "127.0.0.1",
"http.flavor": "1.1",
"http.status_text": "OK",
"http.status_code": 200
"http.request.method": "GET",
"server.address": "localhost",
"url.scheme": "http",
"server.port": 8000,
"url.full": "http://localhost:8000/?param=hello",
"server.socket.address": "127.0.0.1",
"network.protocol.version": "1.1",
"http.response.status_code": 200
},
"events": [],
"links": []
Expand Down
14 changes: 7 additions & 7 deletions opentelemetry-sdk/tests/trace/test_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,12 +640,12 @@ def test_attributes(self):
with self.tracer.start_as_current_span("root") as root:
root.set_attributes(
{
"http.method": "GET",
"http.url": "https://example.com:779/path/12/?q=d#123",
"http.request.method": "GET",
"url.full": "https://example.com:779/path/12/?q=d#123",
}
)

root.set_attribute("http.status_code", 200)
root.set_attribute("http.response.status_code", 200)
root.set_attribute("http.status_text", "OK")
root.set_attribute("misc.pi", 3.14)

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

self.assertEqual(len(root.attributes), 9)
self.assertEqual(root.attributes["http.method"], "GET")
self.assertEqual(root.attributes["http.request.method"], "GET")
self.assertEqual(
root.attributes["http.url"],
root.attributes["url.full"],
"https://example.com:779/path/12/?q=d#123",
)
self.assertEqual(root.attributes["http.status_code"], 200)
self.assertEqual(root.attributes["http.response.status_code"], 200)
self.assertEqual(root.attributes["http.status_text"], "OK")
self.assertEqual(root.attributes["misc.pi"], 3.14)
self.assertEqual(root.attributes["attr-key"], "attr-value2")
Expand Down Expand Up @@ -1007,7 +1007,7 @@ def test_ended_span(self):
self.assertEqual(end_time0, root.end_time)

with self.assertLogs(level=WARNING):
root.set_attribute("http.method", "GET")
root.set_attribute("http.request.method", "GET")
self.assertEqual(len(root.attributes), 0)

with self.assertLogs(level=WARNING):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,200 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# pylint: disable=too-many-lines


class MetricInstruments:
SCHEMA_URL = "https://opentelemetry.io/schemas/v1.21.0"
"""
The URL of the OpenTelemetry schema for these keys and values.
"""

HTTP_SERVER_DURATION = "http.server.duration"
"""
lzchen marked this conversation as resolved.
Show resolved Hide resolved
Measures the duration of inbound HTTP requests
Instrument: histogram
Unit: s
"""

HTTP_SERVER_ACTIVE_REQUESTS = "http.server.active_requests"
"""
Measures the number of concurrent HTTP requests that are currently in-flight
Instrument: updowncounter
Unit: {request}
"""

HTTP_SERVER_REQUEST_SIZE = "http.server.request.size"
"""
Measures the size of HTTP request messages (compressed)
Instrument: histogram
Unit: By
"""

HTTP_SERVER_RESPONSE_SIZE = "http.server.response.size"

HTTP_SERVER_ACTIVE_REQUESTS = "http.server.active_requests"
"""
Measures the size of HTTP response messages (compressed)
Instrument: histogram
Unit: By
"""

HTTP_CLIENT_DURATION = "http.client.duration"
"""
Measures the duration of outbound HTTP requests
Instrument: histogram
Unit: s
"""

HTTP_CLIENT_REQUEST_SIZE = "http.client.request.size"
"""
Measures the size of HTTP request messages (compressed)
Instrument: histogram
Unit: By
"""

HTTP_CLIENT_RESPONSE_SIZE = "http.client.response.size"
"""
Measures the size of HTTP response messages (compressed)
Instrument: histogram
Unit: By
"""

PROCESS_RUNTIME_JVM_MEMORY_INIT = "process.runtime.jvm.memory.init"
"""
Measure of initial memory requested
Instrument: updowncounter
Unit: By
"""

PROCESS_RUNTIME_JVM_SYSTEM_CPU_UTILIZATION = (
"process.runtime.jvm.system.cpu.utilization"
)
"""
Recent CPU utilization for the whole system as reported by the JVM
Instrument: gauge
Unit: 1
"""

PROCESS_RUNTIME_JVM_SYSTEM_CPU_LOAD_1M = (
"process.runtime.jvm.system.cpu.load_1m"
)
"""
Average CPU load of the whole system for the last minute as reported by the JVM
Instrument: gauge
Unit: 1
"""

PROCESS_RUNTIME_JVM_BUFFER_USAGE = "process.runtime.jvm.buffer.usage"
"""
Measure of memory used by buffers
Instrument: updowncounter
Unit: By
"""

PROCESS_RUNTIME_JVM_BUFFER_LIMIT = "process.runtime.jvm.buffer.limit"
"""
Measure of total memory capacity of buffers
Instrument: updowncounter
Unit: By
"""

PROCESS_RUNTIME_JVM_BUFFER_COUNT = "process.runtime.jvm.buffer.count"
"""
Number of buffers in the pool
Instrument: updowncounter
Unit: {buffer}
"""

PROCESS_RUNTIME_JVM_MEMORY_USAGE = "process.runtime.jvm.memory.usage"
"""
Measure of memory used
Instrument: updowncounter
Unit: By
"""

PROCESS_RUNTIME_JVM_MEMORY_COMMITTED = (
"process.runtime.jvm.memory.committed"
)
"""
Measure of memory committed
Instrument: updowncounter
Unit: By
"""

PROCESS_RUNTIME_JVM_MEMORY_LIMIT = "process.runtime.jvm.memory.limit"
"""
Measure of max obtainable memory
Instrument: updowncounter
Unit: By
"""

PROCESS_RUNTIME_JVM_MEMORY_USAGE_AFTER_LAST_GC = (
"process.runtime.jvm.memory.usage_after_last_gc"
)
"""
Measure of memory used, as measured after the most recent garbage collection event on this pool
Instrument: updowncounter
Unit: By
"""

PROCESS_RUNTIME_JVM_GC_DURATION = "process.runtime.jvm.gc.duration"
"""
Duration of JVM garbage collection actions
Instrument: histogram
Unit: s
"""

PROCESS_RUNTIME_JVM_THREADS_COUNT = "process.runtime.jvm.threads.count"
"""
Number of executing platform threads
Instrument: updowncounter
Unit: {thread}
"""

PROCESS_RUNTIME_JVM_CLASSES_LOADED = "process.runtime.jvm.classes.loaded"
"""
Number of classes loaded since JVM start
Instrument: counter
Unit: {class}
"""

PROCESS_RUNTIME_JVM_CLASSES_UNLOADED = (
"process.runtime.jvm.classes.unloaded"
)
"""
Number of classes unloaded since JVM start
Instrument: counter
Unit: {class}
"""

PROCESS_RUNTIME_JVM_CLASSES_CURRENT_LOADED = (
"process.runtime.jvm.classes.current_loaded"
)
"""
Number of classes currently loaded
Instrument: updowncounter
Unit: {class}
"""

PROCESS_RUNTIME_JVM_CPU_TIME = "process.runtime.jvm.cpu.time"
"""
CPU time used by the process as reported by the JVM
Instrument: counter
Unit: s
"""

PROCESS_RUNTIME_JVM_CPU_RECENT_UTILIZATION = (
"process.runtime.jvm.cpu.recent_utilization"
)
"""
Recent CPU utilization for the process as reported by the JVM
Instrument: gauge
Unit: 1
"""

# Manually defined metrics

DB_CLIENT_CONNECTIONS_USAGE = "db.client.connections.usage"
"""
The number of connections that are currently in state described by the `state` attribute
Instrument: UpDownCounter
Unit: {connection}
"""
Loading
Loading