Skip to main content

opentelemetry-semantic-conventions

Version: 0.31.0 The opentelemetry-semantic-conventions crate provides standardized naming patterns for attributes, metrics, and resources in OpenTelemetry, ensuring consistency and interoperability across telemetry data.

Installation

Feature Flags

  • semconv_experimental: Include experimental semantic conventions (not yet stable)

What are Semantic Conventions?

Semantic conventions are agreed-upon naming standards for telemetry attributes, helping:
  • Interoperability: Different tools understand the same attribute names
  • Consistency: Uniform naming across services and languages
  • Automation: Backends can provide better visualizations and insights
  • Discovery: Easier to search and correlate telemetry data

Schema Version

This crate implements semantic conventions version 1.36.0.

Modules

The crate is organized into several modules:
module
Common attribute names for spans, logs, and metrics
module
Resource attribute names (service, host, container, etc.)
module
Standard metric names and units
module
Trace-specific semantic conventions

Common Usage

Resource Attributes

Span Attributes

Metric Attributes

Common Attribute Names

HTTP

Database

Network

Error Attributes

Resource Attribute Names

Service

Host

Container

Kubernetes

Cloud

Metric Names

Complete Example

Experimental Conventions

With the semconv_experimental feature, you can access conventions that are not yet stable:
Experimental conventions may change in future versions. Use with caution in production.

Benefits

Vendor Interoperability

Works across different observability backends

Automated Insights

Backends provide better dashboards and alerts

Consistent Naming

Avoid “method” vs “http.method” vs “httpMethod” confusion

Discovery

Easier to search and correlate across services

Documentation

Full API Documentation

View complete API reference on docs.rs

Semantic Conventions Specification

Official OpenTelemetry semantic conventions

Minimum Rust Version

MSRV: 1.75.0