spotlight icon indicating copy to clipboard operation
spotlight copied to clipboard

feat (overlay): add agent traces to Insights

Open betegon opened this issue 7 months ago • 3 comments

Closes #807

This PR adds first-class support for AI “agent” traces, showing them under a new Agents tab in the Insights view:

New “Agents” tab

  • Registers a fourth Insights tab (“Agents”) alongside Profiles, Envelopes and SDKs.
  • Updates routing (AgentsTab) to render both a list view and detail panel for individual spans.

List an details views

  • AITraceList component renders each AI span with a clickable link into its detail panel.
  • AISpanItem shows a quick timestamped summary in the list.
  • AISpanDetails opens in a side-panel and displays:
    • Operation name, span ID, relative start and duration
    • Tags, context fields (trace/parent/span/op/status)
    • Arbitrary span.data values

AI libraries support

  • Adds an initial AI library registry (aiLibraries.ts) with Vercel AI SDK support.
  • Added envelope fixtures under packages/overlay/_fixtures/ai_sdk/ for testing/developing.

Video demo:

https://github.com/user-attachments/assets/2e20f2b7-2efe-4fc4-b624-23d208398141

Before opening this PR:

  • [x] I added a Changeset Entry with pnpm changeset:add
  • [x] I referenced issues that this PR addresses

betegon avatar May 16 '25 18:05 betegon

@betegon is attempting to deploy a commit to the Sentry Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar May 16 '25 18:05 vercel[bot]

Codecov Report

Attention: Patch coverage is 21.09745% with 834 lines in your changes missing coverage. Please review.

Project coverage is 31.31%. Comparing base (4f3e34a) to head (6ebea14). Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ntry/components/insights/agents/AITraceDetails.tsx 10.06% 295 Missing :warning:
...try/components/insights/agents/sdks/vercelAISDK.ts 21.84% 279 Missing :warning:
.../sentry/components/insights/agents/AITraceList.tsx 21.77% 97 Missing :warning:
...c/integrations/sentry/data/useSpotlightAITraces.ts 15.78% 64 Missing :warning:
.../sentry/components/insights/agents/AITraceItem.tsx 20.00% 32 Missing :warning:
...try/components/insights/agents/sdks/aiLibraries.ts 33.33% 26 Missing :warning:
...lay/src/integrations/sentry/data/useSentrySpans.ts 12.00% 22 Missing :warning:
...ations/sentry/components/insights/agents/index.tsx 28.57% 10 Missing :warning:
...rc/integrations/sentry/store/slices/sharedSlice.ts 12.50% 7 Missing :warning:
.../integrations/sentry/components/insights/index.tsx 33.33% 2 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #804      +/-   ##
==========================================
- Coverage   33.13%   31.31%   -1.82%     
==========================================
  Files         107      114       +7     
  Lines        6160     7216    +1056     
  Branches      122      122              
==========================================
+ Hits         2041     2260     +219     
- Misses       4119     4956     +837     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar May 16 '25 18:05 codecov[bot]

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
spotlightjs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 4, 2025 3:35pm

vercel[bot] avatar May 24 '25 17:05 vercel[bot]

This got way bigger than intended. We're merging this and I'll be addressing @BYK comments

betegon avatar Jun 04 '25 15:06 betegon