{"id":325,"library":"opentelemetry-semantic-conventions","title":"OpenTelemetry Semantic Conventions","description":"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.","status":"active","version":"0.61b0","language":"python","source_language":"en","source_url":"https://github.com/open-telemetry/opentelemetry-python","tags":["opentelemetry","telemetry","semantics","logging"],"install":[{"cmd":"pip install opentelemetry-semantic-conventions","lang":"bash","label":"Install OpenTelemetry Semantic Conventions"}],"dependencies":[],"imports":[{"note":"Ensure to use the correct import path from the semantic conventions module.","symbol":"SemanticAttributes","correct":"from opentelemetry.semconv import SemanticAttributes"}],"quickstart":{"code":"import os\n\n# Example usage of SemanticAttributes\nattribute_key = 'http.method'\nattribute_value = 'GET'\n\nif os.environ.get('OTEL_KEY', ''):\n    print(f'Setting attribute: {attribute_key} = {attribute_value}')\nelse:\n    print('OTEL_KEY not found!')","lang":"python","description":"This quickstart demonstrates how to utilize SemanticAttributes for telemetry data."},"warnings":[{"fix":"Update your usage of these methods according to the new behavior.","message":"The behavior of `start_span` and `start_as_current_span` was updated to propagate span contexts differently.","severity":"breaking","affected_versions":">=1.40.0"},{"fix":"Use `opentelemetry-instrumentation-logging` instead.","message":"The `LoggingHandler` from opentelemetry-sdk is deprecated.","severity":"deprecated","affected_versions":"<1.40.0"},{"fix":"Ensure the 'OTEL_KEY' environment variable is correctly set in the deployment environment.","message":"The application failed because the 'OTEL_KEY' environment variable was not found. This key is typically required for authentication or configuration of the OpenTelemetry collector/exporter.","severity":"gotcha","affected_versions":"All versions where 'OTEL_KEY' is expected"},{"fix":"Ensure the `OTEL_KEY` environment variable is set in your environment or that the equivalent configuration (e.g., an API key within your application's OpenTelemetry setup) is properly provided.","message":"A required environment variable or configuration key named `OTEL_KEY` was not found. This key is often used for API authentication or exporter configuration.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-05-12T13:04:30.513Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"Ensure `opentelemetry-semantic-conventions` is installed (`pip install opentelemetry-semantic-conventions`) and that all OpenTelemetry packages (API, SDK, instrumentation, and semantic conventions) are pinned to compatible versions from the same release train to avoid module location changes.","cause":"This error typically occurs when the `opentelemetry-semantic-conventions` package is not installed, or when there's a version mismatch between `opentelemetry-sdk` and `opentelemetry-semantic-conventions` where the `semconv` module's expected location or existence has changed.","error":"ModuleNotFoundError: No module named 'opentelemetry.semconv'"},{"fix":"Update your code to use the new attribute naming conventions. For example, attributes are now typically accessed directly via `from opentelemetry.semconv.trace import SpanAttributes` is replaced by importing specific attributes, or the attributes themselves have been renamed (e.g., `SpanAttributes` might be replaced by directly using constants from `opentelemetry.semconv.attributes`). Review the latest `opentelemetry-semantic-conventions` documentation for the correct attribute names and import paths for your installed version.","cause":"The `SpanAttributes` constant was removed or renamed in newer versions of `opentelemetry-semantic-conventions`, causing existing code that tries to import it to fail. This is often due to breaking changes in semantic convention definitions across versions.","error":"ImportError: cannot import name 'SpanAttributes' from 'opentelemetry.semconv.trace'"},{"fix":"Pin all OpenTelemetry Python packages (e.g., `opentelemetry-api`, `opentelemetry-sdk`, `opentelemetry-instrumentation-*`, and `opentelemetry-semantic-conventions`) to compatible versions from the same release. For example, if using `opentelemetry-sdk==1.23.0`, ensure `opentelemetry-semantic-conventions==0.44b0` and any instrumentation libraries are also compatible with that release.","cause":"OpenTelemetry Python packages, including `opentelemetry-semantic-conventions`, are released in lockstep, meaning the SDK, API, and instrumentation libraries expect specific, matching versions of the semantic conventions. This error occurs when installing different OpenTelemetry components with incompatible version requirements for `opentelemetry-semantic-conventions`.","error":"ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. Required by opentelemetry-instrumentation-flask==0.44b0: opentelemetry-semantic-conventions==0.44b0 But opentelemetry-sdk==1.22.0 requires: opentelemetry-semantic-conventions==0.43b0."},{"fix":"Migrate your code to use the updated attribute naming convention, typically by replacing `SEMATTRS_` or `SEMRESATTRS_` prefixed attributes with their `ATTR_` counterparts. For example, `SEMATTRS_HTTP_METHOD` should be updated to `ATTR_HTTP_REQUEST_METHOD`. You might also need to import these new constants from a different module path if the structure has changed.","cause":"This error indicates that an attribute constant, specifically one prefixed with `SEMATTRS_` (or `SEMRESATTRS_`), is no longer available in the `opentelemetry-semantic-conventions` module. This is a common breaking change where attribute naming conventions were standardized to use an `ATTR_` prefix instead.","error":"AttributeError: 'module' object has no attribute 'SEMATTRS_HTTP_METHOD'"}],"ecosystem":"pypi","meta_description":null,"install_score":0,"install_tag":"stale","quickstart_score":80,"quickstart_tag":"verified","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"stale","tag_description":"widespread failures or data too old to trust","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":1,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null}]},"quickstart_checks":{"last_tested":"2026-04-23","tag":"verified","tag_description":"quickstart runs on critical runtimes, recently tested","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}}