OpenTelemetry Trace Semantic Conventions ΒΆ

OpenTelemetry Semantic Conventions define a common set of attribute names for spans, so that traces from different languages and libraries can be queried and correlated consistently. This page lists the attributes you are most likely to encounter on traces collected by the Nais platform.

The full specification is maintained upstream at opentelemetry.io.

Legacy attribute names

OpenTelemetry stabilized several attribute names over time. The auto-instrumentation agents on the platform still emit some of the older names β€” notably http.status_code, db.statement, and db.operation β€” alongside their stabilized replacements (http.response.status_code, db.query.text, and db.operation.name). When writing queries, be prepared to check for both the legacy and the stabilized attribute.

Resource attributes ΒΆ

Resource attributes describe the entity producing the telemetry (your workload) and are attached to every span it emits.

AttributeDescriptionExample
service.nameThe name of the service (your application name).my-app
service.namespaceThe namespace (team) the service is deployed in.my-team
k8s.cluster.nameThe Kubernetes cluster hosting the workload.prod-gcp
telemetry.sdk.languageThe language of the SDK that produced the span.java

HTTP attributes ΒΆ

Set on spans that represent HTTP server or client calls.

AttributeStatusDescriptionExample
http.request.methodStableThe HTTP request method.GET
http.response.status_codeStableThe HTTP response status code.200
http.routeStableThe matched route (template), low cardinality./users/{id}
url.pathStableThe path component of the request URL./users/42
url.fullStableThe full request URL.https://…/users/42
server.addressStableThe address of the server handling the request.api.example.com
http.status_codeLegacySuperseded by http.response.status_code.200

Database attributes ΒΆ

Set on spans that represent calls to a database.

AttributeStatusDescriptionExample
db.systemStableThe database management system.postgresql
db.namespaceStableThe name of the database being accessed.orders
db.operation.nameStableThe database operation being executed.SELECT
db.query.textStableThe database statement being executed.SELECT * FROM …
db.nameLegacySuperseded by db.namespace.orders
db.operationLegacySuperseded by db.operation.name.SELECT
db.statementLegacySuperseded by db.query.text.SELECT * FROM …

Messaging attributes ΒΆ

Set on spans that represent producing or consuming messages (e.g. Kafka).

AttributeDescriptionExample
messaging.systemThe messaging system.kafka
messaging.destination.nameThe topic or queue name.my-team.some-topic
messaging.operationThe operation performed on the message.publish
messaging.kafka.message.keyThe Kafka message key.order-42

Sensitive data

Some of these attributes (for example url.path, db.statement, and messaging.kafka.message.key) can contain user data. See Sensitive data for what to check in your application.

Attribute names in span metrics ΒΆ

When trace attributes are turned into span metrics, Prometheus replaces every . (dot) in the attribute name with an _ (underscore) β€” for example http.response.status_code becomes the http_response_status_code label.