-
-
Notifications
You must be signed in to change notification settings - Fork 32
feat: Add continuous profiling support (Sample Format V2) #1202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
229eeb5 to
f3272f9
Compare
- Add SentryProfileV2ChunkEvent type for profile_chunk items - Process and merge V2 chunks by profiler_id - Link profiles to traces via contexts.profile.profiler_id - Unify V1 and V2 profiles in profilesByTraceId storage - Handle late-arriving chunks with re-grafting - Add test fixtures for manual UI testing Closes #567
f3272f9 to
2a0c3aa
Compare
packages/spotlight/vite.node.config.ts.timestamp-1765547683295-021ec3d4141a6.mjs
Outdated
Show resolved
Hide resolved
betegon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, thanks for adding support for this!
| >; | ||
| }; | ||
|
|
||
| export type SentryProfileV2ChunkEvent = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're not sharing types between server and UI right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think so but we can? Should we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think so but we can? Should we?
| // Check if there's an existing transaction with this profiler_id that needs re-grafting | ||
| // This handles the case where profile chunks arrive AFTER the transaction | ||
| let traceToUpdate: string | undefined; | ||
| let activeThreadId: string | undefined; | ||
| for (const evt of eventsById.values()) { | ||
| if (isTraceEvent(evt)) { | ||
| const txn = evt as SentryTransactionEvent; | ||
| const profileCtx = txn.contexts?.profile as { profiler_id?: string } | undefined; | ||
| if (profileCtx?.profiler_id === chunk.profiler_id) { | ||
| traceToUpdate = txn.contexts.trace.trace_id; | ||
| activeThreadId = txn.contexts.trace.data?.["thread.id"] as string | undefined; | ||
| break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! We talked about that, the profiler_id connects it to the transaction 👍
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @spotlightjs/[email protected] ### Minor Changes - Add support for continuous profiling (Profiling V2) ([#1202](#1202)) - Add self-documenting CLI commands with per-command help support ([#1206](#1206)) Each CLI command now provides its own metadata (short description, usage, detailed help, and examples). The main help output is generated dynamically from this metadata, and users can get detailed help for specific commands via `spotlight help <command>` or `spotlight <command> --help`. ### Patch Changes - Remove dead code ([#1214](#1214)) - Fix profile visualization issues in trace views: ([#1203](#1203)) - Update frame colors to use vibrant, high-contrast colors for better visibility - Add custom nanovis palette for Spotlight's dark theme - Fix sunburst center text showing bytes instead of sample counts - Fix treemap visibility with proper color contrast - added support for AI SDK v2 in AI Mode ([#1216](#1216)) - updated the empty pages of traces and envelopes ([#1213](#1213)) - open external links in default browser ([#1212](#1212)) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Summary
Add support for continuous profiling (Profiling V2) while maintaining backward compatibility with transaction-based profiling (V1).
Changes
SentryProfileV2ChunkEventtype forprofile_chunkenvelope itemsprofiler_idcontexts.profile.profiler_idprofilesByTraceIdstorageTesting
Then open Spotlight UI, navigate to the trace, and verify:
Closes #567