Always prefer the established OpenTelemetry semantic conventions. Reusing standardized attribute names ensures interoperability and consistent analysis across traces, metrics, and logs.
Why reuse matters
- Consistency: Standard attribute names allow tools and analysts to interpret telemetry without custom mappings.
- Correlation: Shared attributes make it straightforward to correlate traces, metrics, and logs across services.
- Compatibility: Instrumentation libraries, exporters, and backends expect common attribute names and semantics.
Naming pattern
OpenTelemetry semantic attributes typically use a structured, dot-separated namespace to provide clear meaning. A common pattern is:[domain].[entity].[attribute]
Note: Not every convention includes all three segments; some attributes use domain.attribute or other variations depending on the domain. Use the style appropriate to the specific semantic convention for that domain.
Examples
Below are common OpenTelemetry semantic attributes, their meanings, and guidance on when to use them.Best practices
- Reuse existing attributes: Before creating a new key, check the OpenTelemetry semantic conventions for an authoritative name.
- Prefer resource attributes for global information (e.g.,
service.name) and span attributes for operation-specific context. - Use the structured namespace to keep attributes discoverable and consistent (e.g.,
http.*,db.*,net.*,k8s.*). - When additional context is needed, prefer adding contextual values to existing conventions rather than inventing new keys.
- Document any organization-specific conventions in a central place and map them to OpenTelemetry keys for compatibility.
Tip: Instrumentation libraries and many backends provide mappings for common semantic conventions—reuse those mappings where possible to reduce engineering effort and improve interoperability.
Where to find the conventions
Consult the official OpenTelemetry semantic conventions specification and related resources before defining new attributes:- OpenTelemetry Semantic Conventions specification
- OpenTelemetry Documentation
- OpenTelemetry Semantic Conventions repository