Skip to content

Event processor migration: Vercel AI event processor #20377

Description

@Lms24

core/src/tracing/vercel-ai/index.ts

Another tough one: The vercel AI event processor does a lot of post processing:

  • setting/removing attributes on a single ended span (processEndedVercelAiSpan, applyToolDescriptionsAndTokens) should be easy to port to client.processSpan
  • We accumulate token usage data on parent spans (accumulateTokensForParent, applyAccumulatedTokens). This can become more dangerous because to guarantee continued correctness, we need a guarantee that the child spans end before their parent so that we can accumulate at end time. This might need careful investigation if its the case. Otherwise we loose accuracy.

Activity

  1. linear-code commented on Apr 17, 2026

    @linear-code
  2. Lms24 commented on Apr 17, 2026

    @Lms24
    MemberAuthor

    A note on this: After talking with @alexander-alderman-webb: Instead of continuing to accumulate the token usage stuff, maybe we can switch already to only record the attributes on the child span level and avoid setting anything on parent spans. This should reduce the complexity for streamed spans.

  3. self-assigned this
    on Apr 30, 2026
  4. github-actions commented on May 7, 2026

    @github-actions
    Contributor

    A PR closing this issue has just been released 🚀

    This issue was referenced by PR #20608, which was included in the 10.52.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions