Skip to main content
Back to all articles
AI Engineering 11 min readUpdated October 28, 2026

Keeping AI Telemetry Meaningful Through OpenTelemetry Upgrades

Protect AI dashboards and alerts during telemetry upgrades with explicit source profiles, semantic compatibility checks, coverage signals, and query-level release tests.

By Salman Butt · Senior Full-Stack & Generative AI Engineer
#OpenTelemetry#AI Observability#Schema Migration#Reliability#TypeScript#Python
On this page

A telemetry upgrade should be reviewed as a change to the interface used by dashboards, alerts, and operational decisions. The application compiling successfully is only one part of that review.

Consider a hypothetical AI document-classification service. A release changes the instrumentation package, while the model and application logic stay the same. The service continues processing documents, but one monitoring query stops matching usage records. Depending on the query and visualization, engineers may see an empty panel, a missing series, or a displayed zero. Those states need different interpretations.

The safeguard I would build is an explicit compatibility layer plus a release test that checks the final query result. That test should establish whether the data still represents the same work, not merely whether a familiar attribute name exists.

Describe the measurement before choosing its name

Write down what each operational measurement means. For a model-usage view, that includes its unit, the work it counts, the population it covers, the time window, and the dimensions used to group it.

A small application-owned contract might contain:

MeasurementMeaning in this exampleImportant qualification
Model attemptsAttempts recorded at the application’s provider adapterDefine how retries and cancellations count
Input tokensReported input usage for the selected attempt populationUnknown usage remains unknown
Output tokensReported output usage for that same populationPreserve the provider’s inclusion rules
Usage coverageEligible attempts with accepted usage divided by eligible attemptsDenominator comes from an independent application record
Measurement freshnessAge of the latest relevant source observationQuery execution time does not establish source freshness

These are application definitions, not proposed OpenTelemetry standard names. Keep their definitions in version control alongside the consumers that rely on them.

A source can report a logical operation containing several retries while an application record counts physical attempts. Those populations cannot be compared as if they were identical. Establish the relationship before normalizing the values. This builds on tracing an agent as a distributed system, with a stronger contract between emitted data and its consumers.

Separate library compatibility from telemetry compatibility

OpenTelemetry’s client versioning guidance distinguishes APIs, SDKs, semantic conventions, and instrumentation components. A stable API’s compatibility guarantees do not establish that every developing semantic convention has become a permanent analytics contract.

The GenAI client span documentation currently marks its conventions as Development. Review the specific signal and instrumentation version you use, including provider integrations and framework wrappers. Do not infer emitted behavior solely from the version of the core tracing API.

For each supported deployment profile, record the instrumentation package versions, relevant convention or specification revision, effective capture settings, Collector configuration revision, exporter mapping, and consumer-query revision. A lockfile helps make a deployment reproducible, but does not verify its measurements.

Keep upgrades deliberate and time-bounded. Pinning dependencies is a way to review change, not a reason to postpone security and maintenance updates indefinitely.

Normalize only transformations whose meaning is known

A compatibility adapter can convert a known input profile into a stable application representation. The adapter should not search arbitrarily for a field that resembles the desired value.

For example, my earlier tracing article used custom application usage attributes. The TypeScript adapter below shows a controlled migration from that custom shape to the current GenAI usage attribute shape documented in client inference conventions.

Both profile identifiers in the example are local application labels. They are not OpenTelemetry releases or published schema versions. Select a profile using reviewed instrumentation and deployment configuration. The upstream adapter must already have established which operation or attempt the record represents.

TypeScript
type Usage = Readonly<{  inputTokens: number;  outputTokens: number;}>;​type Result =  | { ok: true; usage: Usage }  | { ok: false; reason: string };​const profiles = new Map<string, readonly [string, string]>([  ["app-usage-v1", ["app.ai.input_tokens", "app.ai.output_tokens"]],  ["genai-usage-v1", ["gen_ai.usage.input_tokens", "gen_ai.usage.output_tokens"]],]);​function isCount(value: unknown): value is number {  return typeof value === "number" &&    Number.isSafeInteger(value) && value >= 0;}​// Profile comes from a verified instrumentation/deployment configuration.// Attributes are decoded data, after the telemetry privacy boundary.function normalizeUsage(  profile: string,  attributes: Readonly<Record<string, unknown>>,): Result {  const keys = profiles.get(profile);  if (!keys) return { ok: false, reason: "unsupported_profile" };​  const input = attributes[keys[0]];  const output = attributes[keys[1]];  if (!isCount(input) || !isCount(output)) {    return { ok: false, reason: "missing_or_invalid_usage" };  }​  // During migration, aliases may coexist. Validate agreement; never add them.  for (const [aliasInput, aliasOutput] of profiles.values()) {    if ((Object.hasOwn(attributes, aliasInput) &&          attributes[aliasInput] !== input) ||        (Object.hasOwn(attributes, aliasOutput) &&          attributes[aliasOutput] !== output)) {      return { ok: false, reason: "conflicting_alias" };    }  }​  return { ok: true, usage: { inputTokens: input, outputTokens: output } };}

The selected profile’s fields must be present and valid. The adapter preserves a legitimate zero, rejects missing usage, and checks agreement when migration aliases coexist. It emits one normalized pair; it never adds the old and new aliases together.

This function handles scalar usage attributes on a decoded record. It does not convert an OTLP metric stream, infer billing semantics, or deduplicate duplicate spans. Select the authoritative instrumentation scope and record boundary before calling it. If two libraries describe the same provider request, avoid accepting both as independent billable work. Deduplicate replayed application events using a durable event identity where needed.

A provider may not report usage on every failure path. That is a source-availability state, not necessarily malformed telemetry. Define eligibility and unknown-usage handling for each route. The example intentionally requires both counts for the successful-response fixture it normalizes.

Check units, populations, and aggregation before adding aliases

Field renaming is the simplest migration case. Other changes require more than substituting a key:

ChangeRequired review
Milliseconds become secondsConvert values and histogram boundaries consistently
A total gains separate cached-token detailCheck whether the detail is already included in the total
A logical operation becomes several attempt recordsReconcile call population, retries, and duplicate instrumentation
A metric changes temporalityPreserve interval and reset semantics through the exporter
A grouping attribute disappearsRevisit attribution and the query’s grouping assumptions
An aggregate changes instrument typeRebuild the aggregation using the new instrument’s meaning

The current GenAI inference documentation describes cached input tokens as included within input-token totals. Adding those two values would therefore count the cached portion twice. Review the provider and instrumentation definitions before extending a cost formula.

OpenTelemetry’s metrics data model distinguishes cumulative and delta temporality and the fields of histogram points. A histogram’s observation count is not the sum of its observed token values. A stream rename does not reconcile changes to units, aggregation, or time windows.

Keep span attributes, metric instruments, and backend-exported series distinct in tests. A token count attached to a span does not prove that a metric query will find the expected series after exporter naming, filtering, aggregation, and label transformations.

Give every consumer an explicit data-health requirement

A cost panel needs two answers: the measured quantity and whether the measurement is complete enough to use. Displaying unavailable data as zero makes those answers indistinguishable.

Use an independent application record to identify eligible calls, then compare that population with accepted usage records over an aligned window. Define allowances for delayed delivery, cancellation, and usage that a provider cannot report. A synthetic release fixture can require exact coverage; production coverage thresholds need to reflect the actual source contract.

Track freshness from relevant source observations rather than the timestamp at which a dashboard query ran. A newly refreshed panel can still be displaying old data. Check each important route or deployment segment so healthy traffic cannot hide a silent segment.

OpenTelemetry compatibility adapter and query validation workflow

*Flow: reviewed telemetry profiles are normalized into canonical measurements, and actual query results are checked for coverage and freshness against independent records and fixtures before release.*

The independent record needs its own reliability controls. Moving both numerator and denominator into the same broken instrumentation would produce reassuring agreement without proving coverage.

This is especially important for enforcement. Budget admission should use the reservation and usage system described in multi-tenant AI cost budgets. Sampled monitoring traces are useful diagnostic evidence, but should not be the sole record that determines whether more spend is permitted.

Test a query result against a known fixture

Build a small deterministic fixture at the provider adapter boundary. For illustration, three synthetic calls could report input counts of 12, 9, and 6, and output counts of 4, 3, and 2. The expected result is three covered calls, 27 input tokens, and 9 output tokens. These are invented test values, not production measurements or a benchmark.

Send those responses through the actual instrumentation, processing, export, ingestion, and query path used by the consumer. Isolate the fixture with a dedicated test environment or bounded test identity. Disable sampling for this fixture, wait for ingestion within a fixed deadline, and run the same query expression that the production panel or rule uses.

The Python function below validates a normalized result returned by that query adapter. Missing series remain None. The observation timestamp must describe the relevant measurement, not merely the backend’s response time.

Python
from dataclasses import dataclassfrom math import isfinitefrom typing import Literal​@dataclass(frozen=True)class QueryResult:    state: Literal["ok", "error"]    observed_at_s: float    covered_calls: int | None    input_tokens: int | None    output_tokens: int | None​def check_usage_fixture(    result: QueryResult,    *,    now_s: float,    max_age_s: float,    expected_calls: int,    expected_input: int,    expected_output: int,) -> list[str]:    def count(value: object) -> bool:        return type(value) is int and value >= 0​    def finite_number(value: object) -> bool:        return type(value) in (int, float) and isfinite(value)​    if not all(count(x) for x in               (expected_calls, expected_input, expected_output)):        raise ValueError("Invalid fixture expectations")    if not finite_number(now_s) or not finite_number(max_age_s) or max_age_s <= 0:        raise ValueError("Invalid freshness policy")​    failures: list[str] = []    if result.state != "ok":        failures.append("query_failed")    if (not finite_number(result.observed_at_s)            or result.observed_at_s > now_s            or now_s - result.observed_at_s > max_age_s):        failures.append("stale_or_invalid_result")​    for name, actual, expected in (        ("covered_calls", result.covered_calls, expected_calls),        ("input_tokens", result.input_tokens, expected_input),        ("output_tokens", result.output_tokens, expected_output),    ):        if not count(actual):            failures.append(f"{name}_missing_or_invalid")        elif actual != expected:            failures.append(f"{name}_mismatch")    return failures​

A query adapter should translate backend errors into an error state and reject unexpected result shapes. It must not invent absent values to satisfy this interface. The validator checks exact totals for the isolated fixture; it is not a general reconciliation algorithm for production billing.

A true zero can pass when the fixture expects zero. An empty result cannot pass by being converted to zero. Coverage checks expose a lost call even when the remaining token totals happen to look plausible. Incorrect aggregation or duplicate series should also change the totals and fail the test.

The code examples here can be tested independently. Integrating them into a deployment still requires testing the actual SDK, Collector, exporter, backend adapter, and queries. A unit test of a dictionary cannot establish that those components preserve the contract.

Exercise the failures a dependency update can expose

Keep focused fixtures for missing fields, unknown profiles, conflicting aliases, legitimate zero values, and invalid numeric types. Add integration cases for duplicate instrumentation, exporter filtering, backend label rewriting, and a route that disappears from the selected query.

Test restart and interval behavior for cumulative streams, and test conversion behavior where a processor changes temporality. Include mixed-version traffic during a rolling deployment. If a retry produces a second usage record, confirm that the query follows the population definition chosen at the start.

Validate alerts as consumers too. Evaluate their expressions against fixtures that represent both a threshold breach and insufficient data, then check the configured handling of each state. Some monitoring products distinguish no data from execution errors; preserve that distinction in your rule configuration. A syntactically valid alert query can still have no relevant population.

Snapshot essential structure and semantics rather than every volatile field. IDs and timestamps will change between runs. Exact field existence, value types, units, scope identity, controlled dimensions, expected totals, and query results are useful assertions. Keep synthetic content and test identifiers within the telemetry data boundary.

Roll out mappings and consumers as one change

Treat a telemetry migration as a compatibility release with a rollback path. Introduce support for the candidate profile before moving every emitter to it. Replay the same approved fixtures through the old and candidate paths, and compare canonical results.

During a canary rollout, segment coverage and normalization failures by a bounded deployment-profile identifier. Keep one authoritative path for metering. If you emit old and new telemetry in parallel for comparison, isolate the comparison output so billing and operational totals do not sum both copies.

Then move the consumer queries and alerts together with the reviewed emitter configuration. Verify the oldest data interval required by weekly or monthly reports. Historical records may retain an earlier shape even after every live worker has upgraded. Keep time-bounded compatibility views or explicit version branches when needed, and retire them against documented query and retention requirements.

A rollback must cover configuration and consumers as well as application packages. Restoring the old library while leaving a new-only query can preserve the outage. Record the compatible combinations in the deployment manifest.

OpenTelemetry’s Telemetry Schemas specification describes schema identifiers and transformations. Use a real applicable published schema and verify the relevant support in your pipeline before relying on it. A fabricated schema URL or a locally invented version label does not supply translation behavior. The current client stability guidance also warns against relying on schema transformations for telemetry stability. An explicit tested adapter remains useful even where schema metadata is available.

Monitor the compatibility layer itself

Useful operational measures include unknown-profile rate, rejected normalization records by bounded reason, conflicting-alias count, eligible-call coverage, source freshness, export loss, ingestion delay, and synthetic-query test success. Connect missing-data behavior to the reliability SLOs that depend on those measurements.

Treat these as separate failure signals. A normalization failure is different from a provider failure; a delayed record is different from a permanently missing one. Preserve enough safe deployment and scope metadata to distinguish them without putting raw prompts, arbitrary attribute keys, or tenant names into metric labels.

Do not make the migration adapter a general object copier. Accept only reviewed source fields, preserve the privacy filter, and avoid exporting rejected payloads in error logs. If schema documents are retrieved dynamically, constrain retrieval to approved publishers or package verified documents with the deployment. Metadata from an untrusted source should not cause unrestricted network fetches or select a privileged transformation.

The compatibility layer has a maintenance cost. Every supported profile and historical query branch creates work. Keep its scope narrow, document retirement criteria, and prefer direct standard instrumentation where its behavior meets the application’s needs. The value is a clear boundary: telemetry upgrades become reviewable changes whose effect on operational decisions is tested before rollout.

Primary sources and topic provenance

Topic discovery: Viral Ruparel’s Your GenAI Dashboards Go Blank After an OpenTelemetry Upgrade, dated October 16, 2026 on the reference site. The classification-service scenario, contract, compatibility adapter, query validator, and diagram here are original.

KEEP READING

Related engineering notes