News · · spec · opentelemetry · announcement

OpenInference Semantic Conventions as a Weaver Registry

The OpenInference semantic conventions are now defined in an OpenTelemetry Weaver registry, validated with the OpenTelemetry policies and published at a schema URL. The spec's tables and the language packages are generated from it.

The OpenInference semantic conventions are now defined in a schema registry built with OpenTelemetry Weaver, the toolchain the OpenTelemetry semantic conventions are authored and validated with. The registry is the source of truth: the attribute tables in the specification and the constants in the Python, TypeScript, Java and Go openinference-semantic-conventions packages are generated from it.

Weaver

OpenInference exists to make AI applications observable now and to bring what works to OpenTelemetry. Until now that second half meant translating by hand: the conventions were markdown and four hand-maintained sets of constants, in no format that OpenTelemetry tooling could read.

Defining them in the same format as OpenTelemetry removes the translation:

  • Same schema. The model is YAML in Weaver’s definition/2 syntax: attributes with a type, stability, examples and enum members, and a span definition for each openinference.span.kind except UNKNOWN that references those attributes with a requirement level.
  • Same policies. CI runs weaver registry check with the shared OpenTelemetry policy package that semantic-conventions-genai uses, pinned to the same revision: naming conventions, stability and backwards compatibility. Three legacy keys (metadata, annotations, evaluations) have no namespace and are listed as explicit exceptions, each with its reason.
  • Shared attributes. The registry declares the OpenTelemetry semantic conventions (1.45.0) as a dependency and references session.id and user.id from it instead of redefining them.
  • Backwards compatibility. On every pull request the shared policy compares the model with the one on the base branch. Removing an attribute or a span fails the build; attributes are deprecated, not removed or renamed.
  • Published at a schema URL. Each version is a resolved registry and a publication manifest, the two files Weaver packages, served at the version’s schema URL. The first is https://openinf.dev/schemas/0.0.1.

With both sets of conventions in one format, an OpenInference attribute and a gen_ai.* attribute can be compared field by field, and a convention proposed upstream starts from a definition OpenTelemetry’s tooling already accepts.

Complex attributes

OTLP span attributes cannot hold objects, so OpenInference flattens lists into indexed keys (llm.input_messages.0.message.role) or serializes them to JSON. OTel doesn’t have primitives for this. Because of this, the registry models a flattened value as template[any], which is what lets Weaver resolve an indexed key to its attribute, and records the encoding in an annotation:

- key: llm.input_messages
  type: template[any]
  brief: List of messages sent to the LLM in a chat API request, e.g. `llm.input_messages.0.message.role`.
  stability: development
  annotations:
    openinference:
      encoding: flattened_list
      item_namespaces:
        - message

OpenInference-specific Rego policies check those annotations. The limit today: Weaver matches the prefix only, so a misspelled leaf after llm.input_messages.0. still resolves. Validating the leaves is tracked in #4419.

Telemetry compliance

weaver registry live-check resolves the registry and reports every attribute it does not define. Given a file of attributes:

[
  {"attribute": {"name": "openinference.span.kind", "value": "LLM"}},
  {"attribute": {"name": "llm.token_count.prompts", "value": 12}}
]
weaver registry live-check \
  -r 'https://github.com/Arize-ai/openinference.git@semantic-conventions-v0.0.1[semantic-conventions/model]' \
  --input-source attributes.json --input-format json

the misspelled key is a violation and the command exits non-zero:

llm.token_count.prompts = 12
    - [violation] Attribute 'llm.token_count.prompts' does not exist in the registry.

Without --input-source, live-check listens for OTLP over gRPC, so an application’s exporter can point at it directly. The repository’s own CI runs the same check on sample keys that must and must not resolve.

Consuming the registry

The resolved registry is one YAML file with every reference and dependency inlined:

curl -fsSLO https://openinf.dev/schemas/0.0.1/registry.yaml

To define conventions on top of OpenInference, declare it as a dependency in a Weaver manifest and ref its attributes; the dependent registry also inherits the OpenTelemetry attributes that OpenInference references. The registry page in the spec covers the file layout, the annotations, and the manifest.

Changing the conventions

A new attribute now starts in the model under semantic-conventions/model, not in a language package. make -C semantic-conventions generate renders the spec tables and the four packages from Weaver templates, and CI fails a pull request whose generated files do not match the model.

Feedback

Everything in the registry is at development stability, so the schema can still change. We want to hear about:

  • a missing well-known value
  • a structure the annotations cannot express, or that your tooling cannot read
  • anything that would make the conventions easier to align with OpenTelemetry

Open an issue.

Release notes