otel-semantic-conventions

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

OpenTelemetry Semantic Conventions

OpenTelemetry语义规范

Semantic conventions define standardized names, types, and semantics for telemetry attributes, span names, metric instruments, and log fields. They ensure that telemetry from different libraries, frameworks, and services describes the same concepts in the same way — enabling correlation, querying, and tooling across the entire stack.
The Attribute Registry is the single source of truth for all defined attributes.
语义规范为遥测属性、Span名称、度量工具和日志字段定义了标准化的名称、类型和语义。它们确保来自不同库、框架和服务的遥测数据以相同方式描述相同概念,从而实现整个技术栈的关联、查询和工具适配。
Attribute Registry是所有已定义属性的唯一可信来源。

Rules

规则

RuleDescription
attributesAttribute registry, selection, placement, common attributes by domain
versioningSemconv versioning, stability, migration
dash0Dash0 derived attributes and feature dependencies
规则描述
attributes属性注册表、选择、放置、按领域划分的通用属性
versioning语义规范(Semconv)版本控制、稳定性、迁移
dash0Dash0衍生属性及功能依赖

Official documentation

官方文档

Key principles

核心原则

  • Registry first — Search the Attribute Registry before creating any custom attribute
  • No custom attributes unless necessary — Custom names fragment querying and break tooling
  • Low cardinality in names — Span names and metric attribute values must be bounded; variable data goes in attributes
  • Right level, every time — Place attributes at the correct telemetry level (resource, scope, span, log, metric)
  • Consistent placement — Once an attribute is at a level, keep it there across all services
  • 优先使用注册表 — 创建任何自定义属性前,请先搜索Attribute Registry
  • 非必要不使用自定义属性 — 自定义名称会分散查询逻辑并破坏工具兼容性
  • 名称低基数 — Span名称和度量属性值必须是有限的;可变数据应放在属性中
  • 始终选择正确层级 — 将属性放置在正确的遥测层级(resource、scope、span、log、metric)
  • 放置保持一致 — 一旦属性确定了层级,所有服务中都要保持该层级不变

Quick reference

快速参考

Use CaseRule
Choosing or reviewing attributesattributes
HTTP/DB/messaging/RPC attributesattributes
Attribute placement (resource vs span)attributes
Naming a span or choosing span kindspans
Span status code mappingspans
Semconv version migrationversioning
Dash0 derived attributesdash0
使用场景规则
选择或审核属性attributes
HTTP/数据库/消息队列/RPC属性attributes
属性放置(resource vs span)attributes
命名Span或选择Span类型spans
Span状态码映射spans
语义规范(Semconv)版本迁移versioning
Dash0衍生属性dash0