Skip to content

Commit

Permalink
Implement 'process.runtime.*' attributes for resources
Browse files Browse the repository at this point in the history
Implement support for the the 'process.runtime.name',
'process.runtime.version' and 'process.runtime.description'
as specified in the resource semantic conventions for
processes.
  • Loading branch information
Michele Mancioppi authored and mmanciop committed May 4, 2022
1 parent cdab6e1 commit b3c4826
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.11.1-0.30b1...HEAD)

- Implement 'process.runtime.{name,version,description}' resource attributes
([#2660](https://github.com/open-telemetry/opentelemetry-python/pull/2660))
- Move Metrics API behind internal package
([#2651](https://github.com/open-telemetry/opentelemetry-python/pull/2651))

Expand Down
15 changes: 14 additions & 1 deletion opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@
)
print(trace.get_tracer_provider().resource.attributes)
{'telemetry.sdk.language': 'python',
{'process.runtime.name': 'cpython',
'process.runtime.version': '3.8.6',
'process.runtime.description': '3.8.6 (default, Sep 30 2020, 04:00:38) [GCC 10.2.0]'
'telemetry.sdk.language': 'python',
'telemetry.sdk.name': 'opentelemetry',
'telemetry.sdk.version': '0.13.dev0',
'service.name': 'shoppingcart',
Expand All @@ -59,6 +62,7 @@
import concurrent.futures
import logging
import os
import sys
import typing
from json import dumps

Expand Down Expand Up @@ -243,8 +247,17 @@ def __hash__(self):


_EMPTY_RESOURCE = Resource({})
_runtime_version = ".".join(map(
str,
sys.version_info[:3]
if sys.version_info.releaselevel == "final" and not sys.version_info.serial
else sys.version_info
))
_DEFAULT_RESOURCE = Resource(
{
PROCESS_RUNTIME_NAME: sys.implementation.name,
PROCESS_RUNTIME_VERSION: _runtime_version,
PROCESS_RUNTIME_DESCRIPTION: sys.version,
TELEMETRY_SDK_LANGUAGE: "python",
TELEMETRY_SDK_NAME: "opentelemetry",
TELEMETRY_SDK_VERSION: _OPENTELEMETRY_SDK_VERSION,
Expand Down

0 comments on commit b3c4826

Please sign in to comment.