feat(cloudflare): Split alarms into multiple traces and link them#19373
Open
feat(cloudflare): Split alarms into multiple traces and link them#19373
Conversation
Contributor
Codecov Results 📊Generated by Codecov Action |
Contributor
size-limit report 📦
|
66f0030 to
b949de1
Compare
b949de1 to
ce3a761
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
JPeer264
commented
Feb 20, 2026
| const result = Reflect.apply(target, thisArg, args); | ||
| const executeSpan = (): unknown => { | ||
| return startSpan({ name: spanName, attributes, links }, async span => { | ||
| // TODO: Remove this once EAP can store span links. We currently only set this attribute so that we |
Member
Author
There was a problem hiding this comment.
note: this is a 1:1 copy from here:
sentry-javascript/packages/browser/src/tracing/linkedTraces.ts
Lines 193 to 202 in 4ee0fea
8d8c709 to
05ad36f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #19105
closes JS-1604
closes #19453
closes JS-1774
This actually splits up alarms into its own traces and binding them with span links. It also adds the
setAlarm,getAlarmanddeleteAlarminstrumentation, which is needed to make this work.The logic works as following. When
setAlarmis getting called it will store the alarm inside the durable object. Once thealarmis being executed the previous trace link will be retrieved viactx.storage.getand then set as span link. Using the durable object itself as storage between alarms is even used on Cloudflare's alarm page.Also it is worth to mention that only 1 alarm at a time can happen, so it is safe to use a fixed key for the previous trace. I implemented the trace links, so they could be reused in the future for other methods as well, so they are not exclusively for alarms.