﻿# Routing history in traces: repeated attributes retain state, not every decision

A practical investigation of routing history in traces: repeated attributes retain state, not every decision, with explicit observations, control cases and evidence limits.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/field-observe-attribute-overwrite-routing-history/
Language: en

## The diagnostic situation

A request passes through several eligible-worker choices before execution. Instrumentation repeatedly writes the selected worker into the same span attribute. The final trace shows only the last value, and the incident report concludes that no earlier routing decision occurred. The application behaved as a sequence, but the observation represented it as mutable final state.

## Why the observation changes meaning

The tracing API describes overwriting an attribute when the same key is set again, and the common model requires unique attribute keys in exported collections. An attribute map is therefore not an append-only decision journal. Span events offer a different representation for named observations over time. Their own limits and recording boundaries still apply, so changing representation alone does not guarantee complete history.

## Define the instrumentation contract

Define which fields describe final request state and which routing transitions require retained evidence. For a bounded history, record safe decision events with outcome, relevant candidate class and reason category. Preserve actual execution identity separately. Do not put full prompts, unrestricted addresses or every candidate identifier into metric labels. A final selected-worker attribute remains useful when its meaning is explicitly final.

## A bounded verification procedure

Construct a synthetic routing sequence with an initial choice, a controlled reconsideration and final execution. Capture instrumentation calls and exported data. Compare repeated attribute writes with the expected final state, then verify the event history against the full sequence. Include an event-limit case so the checker distinguishes truncated history from a confirmed absence of earlier decisions.

## Evidence required for acceptance

Acceptance evidence includes the routing state model, event schema, effective limits and exported fixtures. Show which original choices are recoverable and which are represented only by a dropped-event count or another controlled record. Verify that dashboards do not infer a full path from one final field. A neat final-state trace can be correct while remaining insufficient for the historical question.

## Failure cases and limits

Routing events document reported decisions, not necessarily successful execution on every candidate. Retries, speculative choices and worker rejection need separate outcomes. This protocol validates state-versus-history representation in instrumentation. It does not prove optimal routing, preserve unbounded decision history or establish exact distributed chronology from event timestamps alone. Retain those limits when using the record to explain a serving incident.

## Primary references and related reading

Repeated SetAttribute updates can replace earlier values; routing transitions need an explicit event history when that history matters. [OpenTelemetry tracing API specification](https://opentelemetry.io/docs/specs/otel/trace/api/); [OpenTelemetry common attribute specification](https://opentelemetry.io/docs/specs/otel/common/).

The proposed investigation of attribute overwrite routing history is not an executed deployment benchmark. Related reading: [Request IDs and trace context across gateway, API and engine](/journal/provider-request-id-trace-context/); [Dynamo KV-aware routing: balance cached context against queueing](/journal/dynamo-kv-aware-routing-cache-queue/).
