Observabilitysemconvgen_ai semantic conventionsresource attributes

Semantic conventions

Definition

Semantic conventions are the OpenTelemetry specification of attribute names, values and units for common operations (HTTP, databases, messaging, generative AI) and for resources such as service.name.

In practice

If one team records status, another http_status and a third code, no dashboard or query works across services. Shared conventions let backends build generic views (RED metrics per route, database span analysis) and let auto-instrumentation and hand-written spans agree. Resource attributes like service.name and deployment.environment.name identify where data came from.

Conventions change over time: HTTP attributes were renamed when they stabilised, and the generative AI conventions (gen_ai.*) are still evolving. Pin the version you emit and plan migrations, because renamed attributes break saved queries and alerts. Do not invent custom names when a convention exists.

Example

An LLM call span carries gen_ai.operation.name=chat, gen_ai.request.model=gpt-4o and gen_ai.usage.input_tokens=812, so token cost can be charted across every service that calls a model.