Skip to content

Telemetry Schemas and Semantic Convention Migration: OTCA practice questions

Semantic conventions change over time. Attributes get renamed, grouped into better namespaces or corrected, and every such change can break a dashboard or alert that looks for the old name. Telemetry schemas exist so that semantic conventions, the sources that emit telemetry and the consumers that read it can evolve independently without breaking each other.

By Ibrahim Yesilay · Published · Updated

Independent community practice, not affiliated with or endorsed by CNCF or The Linux Foundation.

What Telemetry Schemas and Semantic Convention Migration covers in OTCA

Semantic conventions change over time. Attributes get renamed, grouped into better namespaces or corrected, and every such change can break a dashboard or alert that looks for the old name. Telemetry schemas exist so that semantic conventions, the sources that emit telemetry and the consumers that read it can evolve independently without breaking each other.

A telemetry schema is versioned and identified by a Schema URL. The URL must point to a schema file that can actually be downloaded over HTTP or HTTPS, and the last segment of its path is the version number. Everything before that segment is the Schema Family identifier, so all versions of one schema share the same prefix. Published schema files never change, which means a consumer can cache them permanently or bundle them at build time. Version numbers follow MAJOR.MINOR.PATCH ordering rules borrowed from SemVer 2.0, and the OpenTelemetry schema version matches the semantic conventions release that publishes it, available under opentelemetry.io/schemas followed by the version.

A schema file is YAML. Its file_format field states the format version and has nothing to do with the schema version. The schema_url field must carry the highest version listed in the versions section. Each version lists changes in sections named all, resources, spans, span_events, metrics and logs, and the supported transformations are deliberately few, mainly renaming attributes, plus renaming events and metrics in their own sections. The all section is applied first, then the section for the data type being converted. Note that the 1.1.0 file format is still marked Development.

Telemetry carries its schema through OTLP. A schema_url field exists at the resource level and at the instrumentation scope level, and when both are set the scope value takes precedence for the data inside that scope. The API also lets instrumentation obtain a Tracer or Meter associated with a schema URL. In the Collector the debug exporter at detailed verbosity prints both values, which is a quick way to see which version a source emits.

Consumers that care about a particular version can translate. In the Collector, the contrib schema processor, currently alpha, takes a list of target schema URLs, one per family, fetches the schema files needed and rewrites incoming telemetry to the target version. By default it does hard renames, dropping the old attribute name. A migration entry with a target and a from version makes it write both names for a while so that queries can be updated first.

Instrumentation libraries have their own migration switch for the move from experimental to stable conventions. For HTTP, OpenTelemetry-published instrumentations should accept OTEL_SEMCONV_STABILITY_OPT_IN with http, which emits only the stable names such as http.request.method, or http/dup, which emits old and new names together. Without the variable they keep emitting the old conventions.

Key points

  • A Schema URL ends in the schema version, the preceding part identifies the Schema Family, and published schema files are immutable.
  • OpenTelemetry schema versions match semantic conventions versions.
  • OTLP carries schema_url at resource and scope level, and the scope value wins when both are set.
  • The contrib schema processor translates telemetry to target schema versions and can keep old and new names during a migration.
  • OTEL_SEMCONV_STABILITY_OPT_IN=http/dup makes HTTP instrumentations emit both old and stable attribute names.

Three sample questions

8 OTCA questions on Telemetry Schemas and Semantic Convention Migration, 8 with explanations. How practice works

Question 1

Your telemetry data includes events within spans, and you need to rename the attribute 'db.session_id' to 'database.session_id' only for events within spans named 'checkout_service'. How should you configure the 'rename_attributes' transformation in the 'span_events' section of the schema file?
  1. A.Use 'rename_attributes' in the 'span_events' section with 'apply_to_spans' set to ['checkout_service'].
  2. B.Use 'rename_attributes' in the 'all' section with the attribute map.
  3. C.Use 'rename_attributes' in the 'span_events' section with 'apply_to_events' set to ['checkout_service'].
  4. D.Use 'rename_attributes' in the 'span_events' sections without any conditional fields.

Correct answer: A

The Schema File Format 1.1.0 spec says the rename_attributes transformation in the span_events section can optionally name the spans and the events it applies to, and that both conditions must match if they are given. apply_to_spans lists span names, so setting it to ['checkout_service'] limits the rename to events of spans with that name. Why the other options are wrong. "Use 'rename_attributes' in the 'all' section with…": a rename in the all section applies to every data type and cannot be limited to the events of one span name. "Use 'rename_attributes' in the 'span_events' section with 'apply_to_ev…": apply_to_events matches event names, so this would look for events called checkout_service, not spans with that name. "Use 'rename_attributes' in the 'span_events' sections withou…": without apply_to_spans the rename would hit span events of every span, not only those of checkout_service.

Sources: OpenTelemetry spec: Schema File Format 1.1.0, OpenTelemetry spec: Telemetry Schemas

Question 2

Your instrumentation library has updated its telemetry schema to a newer version. How should a telemetry consumer handle data emitted with this new schema version?
  1. A.Request the telemetry source to revert to the older schema version.
  2. B.Transform the data to the schema version it expects, if that is needed.
  3. C.Ignore the Schema URL and process the data as per the consumer's existing schema.
  4. D.Reject any telemetry data that does not match the consumer's current schema version.

Correct answer: B

The Telemetry Schemas spec says sources include a Schema URL in their telemetry and "telemetry consumers may transform the telemetry data from the received schema version to the target schema version as expected at the point of use", for example a dashboard that expects one version. Schema files exist precisely to describe those transformations. Why the other options are wrong. "Request the telemetry source to revert to the olde…": schemas are designed so that sources can move on and consumers adapt, not so that sources must roll back. "Ignore the Schema URL and process the data as per…": ignoring the Schema URL throws away the information the consumer needs to interpret renamed attributes correctly. "Reject any telemetry data that does not match the…": rejecting data defeats the purpose of schemas, which allow conversion between versions of the same schema family.

Sources: OpenTelemetry spec: Telemetry Schemas, OpenTelemetry spec: Schema File Format 1.1.0

Question 3

Which of the following conditions requires incrementing the MINOR version number of the schema file format?
  1. A.Changing the meaning of an existing setting so older consumers misread it.
  2. B.Adding a new required setting that affects existing consumers.
  3. C.Adding an optional setting whose default keeps the old behavior.
  4. D.Changing the data type of an existing attribute

Correct answer: C

The Schema File Format spec says "MINOR number SHOULD be increased if a new setting is added to the file format in a backward compatible manner", for example a new transformation type or a new setting on an existing transformation. An optional setting whose default keeps the old behaviour fits that rule. Why the other options are wrong. "Changing the meaning of an existing setting so old…": changing what an existing setting means breaks older consumers; the spec reserves incompatible changes for a MAJOR bump. "Adding a new required setting that affects existin…": a new required setting that existing consumers must handle is incompatible, which calls for a MAJOR increase. "Changing the data type of an existing attribute": attribute data types belong to the telemetry, not to the schema file format, so this does not drive the file format version.

Sources: OpenTelemetry spec: Schema File Format 1.1.0, OpenTelemetry spec: Telemetry Schemas

Practice this topic

Focus mode keeps every question on Telemetry Schemas and Semantic Convention Migration until you leave it. 10 free guest answers, then a free account; no credit card.

Or open OTCA practice across all topics.

Sources

The explanation above was checked against these official documents.

Frequently asked questions

Is the file_format value the same as the schema version?

No. file_format describes the layout of the schema file itself, while the schema version is the last segment of the schema_url.