The most common failure in prompt tracking is deciding the version after the fact. A team keeps prompts in a Git repository, deploys a change, and then tries to answer "which prompt produced this bad output?" by matching timestamps against deployment records. That works until two prompts for different features ship within the same hour, or until a rollback, a canary, or a per-tenant override puts more than one version in production at once. OpenTelemetry's model for this is clear: a trace is the path of a request through your application, and spans are the units of work inside it, carrying attributes that describe what happened (OpenTelemetry traces). A span is one chapter of a story, capturing an operation such as a vector search or a model inference call with its own attributes, status and timing (span instrumentation). If the prompt version is not an attribute on the span and not a column on the log row, you have no reliable way to attach it later.
There is a second reason to write the version early. The moment a request is composed, your service already knows which template it filled in and with which variables. That knowledge is free at that point. Recovering it downstream means re-deriving intent from a rendered string, which fails as soon as a variable contains text that looks like template syntax or a user pastes in a competing instruction.
The trace context is the right home for the version id because it crosses network boundaries. When you call a model through an HTTP client, instrumentation creates a client span, and context propagation stitches spans from different services into one trace, which is the core mechanism that makes distributed tracing work (OpenTelemetry traces). A version id set as an attribute on a span reaches your backend with the rest of the trace, alongside attributes like model name and token counts (GenAI conventions guide).
One practical warning: prompt and response bodies are deliberately kept out of standard attributes by the GenAI conventions, because they routinely contain personal data (OpenObserve). That is exactly why the version id, a low-cardinality identifier that carries no content, is the thing you should always record. Keep a hash or a redacted preview for inspection and the version id for joining (observability for AI agents).



