otel-semantic-conventions

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

OpenTelemetry Semantic Conventions

OpenTelemetry Semantic Conventions

Use this skill when you need released semantic convention guidance for naming, attributes, or compliance checks.
当你需要已发布的语义规范来指导命名、属性设置或合规性检查时,可以使用本技能。

Workflow

工作流程

  1. Start with released semantic conventions, not model memory.
  • do not load the full semantic convention spec into context
  • use the bundled lookup script to query only the needed released group or attribute
  • for local verification against a checked-out upstream repo, set
    OTEL_SEMCONV_REPO=/path/to/semantic-conventions
  1. Choose the closest released group before inventing custom keys.
  • identify the boundary type such as
    http
    ,
    db
    ,
    messaging
    ,
    rpc
    , or
    network
  • pick one primary group first, then add related groups only when they add needed context
  • for
    gen_ai.*
    , OpenAI, or MCP conventions, use the dedicated OpenTelemetry GenAI semantic conventions repository; the core repository keeps only deprecated GenAI-era stubs after v1.42.0
  • see
    references/semconv-selection.md
  1. Query only the released guidance you need.
  • list groups:
    ./scripts/query-otel-semantic-conventions.sh --groups
  • inspect one group:
    ./scripts/query-otel-semantic-conventions.sh http
  • inspect one kind:
    ./scripts/query-otel-semantic-conventions.sh http spans
  • inspect one exact attribute or entry:
    ./scripts/query-otel-semantic-conventions.sh http http.request.method
  • see
    references/otel-semantic-conventions.md
  • after changing the parser, run
    OTEL_SEMCONV_REPO=/path/to/semantic-conventions bash ./scripts/test-query-otel-semantic-conventions.sh
  1. Apply the released naming and attribute rules directly.
  • use required and recommended attributes before optional ones
  • derive semconv-governed span names directly from the released naming rule
  • do not prepend or append protocol labels, hostnames, product names, business hints, or other custom prose to semconv-governed span names
  • if the released naming rule does not provide a low-cardinality target, use the simpler fallback allowed by that convention
  • if no released key exists, use a stable custom namespace and keep values bounded
  1. Return the result with exact source context.
  • include the group name, released version, and source URL from the script output
  • call out any concrete compatibility limitation if the implementation cannot fully match the released guidance
  1. 从已发布的语义规范入手,而非依赖模型记忆。
  • 不要将完整的语义规范规范加载到上下文当中
  • 使用捆绑的查询脚本仅查询所需的已发布组或属性
  • 若要针对已检出的上游仓库进行本地验证,请设置
    OTEL_SEMCONV_REPO=/path/to/semantic-conventions
  1. 在自定义键之前,选择最匹配的已发布组。
  • 确定边界类型,例如
    http
    db
    messaging
    rpc
    network
  • 先选择一个主组,仅当相关组能提供必要上下文时再添加
  • 对于
    gen_ai.*
    、OpenAI 或 MCP 规范,请使用专用的 OpenTelemetry GenAI 语义规范仓库;核心仓库在 v1.42.0 之后仅保留已弃用的 GenAI 时代存根
  • 请查看
    references/semconv-selection.md
  1. 仅查询你所需的已发布指南。
  • 列出所有组:
    ./scripts/query-otel-semantic-conventions.sh --groups
  • 查看单个组:
    ./scripts/query-otel-semantic-conventions.sh http
  • 查看单个类型:
    ./scripts/query-otel-semantic-conventions.sh http spans
  • 查看单个具体属性或条目:
    ./scripts/query-otel-semantic-conventions.sh http http.request.method
  • 请查看
    references/otel-semantic-conventions.md
  • 修改解析器后,运行
    OTEL_SEMCONV_REPO=/path/to/semantic-conventions bash ./scripts/test-query-otel-semantic-conventions.sh
  1. 直接应用已发布的命名和属性规则。
  • 优先使用必填和推荐属性,再考虑可选属性
  • 直接从已发布的命名规则生成受 semconv 管控的 Span 名称
  • 不要在受 semconv 管控的 Span 名称前或后添加协议标签、主机名、产品名、业务提示或其他自定义描述
  • 如果已发布的命名规则未提供低基数目标,请使用该规范允许的更简单回退方案
  • 如果不存在已发布的键,请使用稳定的自定义命名空间并限制值的范围
  1. 返回包含精确源上下文的结果。
  • 包含脚本输出中的组名、已发布版本和源 URL
  • 如果实现无法完全匹配已发布的指南,请明确指出具体的兼容性限制