Skip to content

Commit 78687a8

Browse files
author
Michele Mancioppi
committed
Implement 'process.runtime.*' attributes for resources
Implement support for the the 'process.runtime.name', 'process.runtime.version' and 'process.runtime.description' as specified in the resource semantic convensions for processes. Closes #2659
1 parent cdab6e1 commit 78687a8

File tree

1 file changed

+13
-1
lines changed
  • opentelemetry-sdk/src/opentelemetry/sdk/resources

1 file changed

+13
-1
lines changed

opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@
4343
)
4444
print(trace.get_tracer_provider().resource.attributes)
4545
46-
{'telemetry.sdk.language': 'python',
46+
{'process.runtime.name': 'cpython',
47+
'process.runtime.version': '3.8.6',
48+
'process.runtime.description': '3.8.6 (default, Sep 30 2020, 04:00:38) [GCC 10.2.0]'
49+
'telemetry.sdk.language': 'python',
4750
'telemetry.sdk.name': 'opentelemetry',
4851
'telemetry.sdk.version': '0.13.dev0',
4952
'service.name': 'shoppingcart',
@@ -243,8 +246,17 @@ def __hash__(self):
243246

244247

245248
_EMPTY_RESOURCE = Resource({})
249+
_runtime_version = ".".join(map(
250+
str,
251+
implementation.version[:3]
252+
if implementation.version.releaselevel == "final" and not implementation.version.serial
253+
else implementation.version
254+
))
246255
_DEFAULT_RESOURCE = Resource(
247256
{
257+
PROCESS_RUNTIME_NAME: implementation.name,
258+
PROCESS_RUNTIME_VERSION: _runtime_version,
259+
PROCESS_RUNTIME_DESCRIPTION: sys.version,
248260
TELEMETRY_SDK_LANGUAGE: "python",
249261
TELEMETRY_SDK_NAME: "opentelemetry",
250262
TELEMETRY_SDK_VERSION: _OPENTELEMETRY_SDK_VERSION,

0 commit comments

Comments
 (0)