Copies OpenInference context attributes onto a span at start time.
The Vercel AI SDK creates its own spans, so unlike the OpenInference instrumentors
(which build spans through an OITracer)
this processor never reads the OpenInference context. That means values set with the
@arizeai/openinference-core helpers — setSession, setUser, setMetadata,
setTags — are dropped: a session.id set via
would never reach the exported AI spans. reparentOrphanedSpan makes this worse:
once the HTTP/server span that carried the session is filtered out and the AI span is
re-rooted, there is nothing left holding the session id.
When propagateContextAttributes is enabled this reads every OpenInference attribute
(session.id, user.id, metadata.*, tag.tags, …) from the start-time context and
writes it directly onto the span, so the values survive reparenting and export and
traces group into sessions in Arize / Phoenix. Setting them at onStart means children
started in the same context inherit them too.
Wrapped in withSafety so a malformed context can never break the span pipeline.
Copies OpenInference context attributes onto a span at start time.
The Vercel AI SDK creates its own spans, so unlike the OpenInference instrumentors (which build spans through an OITracer) this processor never reads the OpenInference context. That means values set with the
@arizeai/openinference-corehelpers —setSession,setUser,setMetadata,setTags— are dropped: asession.idset viawould never reach the exported AI spans. reparentOrphanedSpan makes this worse: once the HTTP/server span that carried the session is filtered out and the AI span is re-rooted, there is nothing left holding the session id.
When
propagateContextAttributesis enabled this reads every OpenInference attribute (session.id,user.id,metadata.*,tag.tags, …) from the start-time context and writes it directly onto the span, so the values survive reparenting and export and traces group into sessions in Arize / Phoenix. Setting them atonStartmeans children started in the same context inherit them too.Wrapped in withSafety so a malformed context can never break the span pipeline.