OpenTelemetry Semantic Conventions
OpenTelemetry Semantic Conventions library for OpenTelemetry projects, providing standard definitions and formats for telemetry data. Currently at version 0.61b0, it follows a semi-regular release cadence with breaking changes announced in advance.
Warnings
- breaking The behavior of `start_span` and `start_as_current_span` was updated to propagate span contexts differently.
- deprecated The `LoggingHandler` from opentelemetry-sdk is deprecated.
Install
-
pip install opentelemetry-semantic-conventions
Imports
- SemanticAttributes
from opentelemetry.semconv import SemanticAttributes
Quickstart
import os
# Example usage of SemanticAttributes
attribute_key = 'http.method'
attribute_value = 'GET'
if os.environ.get('OTEL_KEY', ''):
print(f'Setting attribute: {attribute_key} = {attribute_value}')
else:
print('OTEL_KEY not found!')