Conversation
8f6a8b4 to
e509cb6
Compare
e509cb6 to
5ea0d02
Compare
5ea0d02 to
2905cce
Compare
8b46a73 to
b3bd79f
Compare
b3bd79f to
5ab473f
Compare
5ab473f to
a27e5e5
Compare
a32be8d to
af060b8
Compare
5146682 to
80b661b
Compare
80b661b to
f1ba13c
Compare
szokeasaurusrex
left a comment
There was a problem hiding this comment.
Admittedly only skimmed this, as the PR is quite huge, but I left a few questions
24d5a46 to
ff67282
Compare
ff67282 to
c7f455b
Compare
c7f455b to
a7e13ce
Compare
a7e13ce to
f1cf3a9
Compare
f1cf3a9 to
ffd5441
Compare
ffd5441 to
5d18fe6
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5d18fe6. Configure here.
5d18fe6 to
dee2303
Compare
dee2303 to
51abc52
Compare
Apply the single scope selected by the capture context directly to events, preserve event precedence, enforce breadcrumb limits, and run request processing and event processors after releasing the scope lock. Preserve explicitly supplied event and scope trace contexts, and retain dynamic sampling context only when it belongs to the selected trace. Event values now take precedence over scope values during capture, context scopes replace the global scope, and scope breadcrumbs and attachments are applied before event-specific values.
51abc52 to
e5ae7c8
Compare
| func mergeBreadcrumbs(scope, event []*Breadcrumb, limit int) []*Breadcrumb { | ||
| switch { | ||
| case limit < 0: | ||
| return nil |
There was a problem hiding this comment.
Bug: When MaxBreadcrumbs is negative, mergeBreadcrumbs returns nil, which clears any pre-existing breadcrumbs on an event instead of preserving them.
Severity: MEDIUM
Suggested Fix
Modify mergeBreadcrumbs to return the original eventBreadcrumbs slice unmodified when the limit is negative. This will preserve any breadcrumbs already on the event while correctly preventing new scope breadcrumbs from being added, aligning with the intended behavior of ignoring breadcrumbs.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: scope.go#L523-L526
Potential issue: When `MaxBreadcrumbs` is set to a negative value, the
`mergeBreadcrumbs` function unconditionally returns `nil`. This `nil` value is then
assigned to `event.Breadcrumbs` in the `applyToEvent` function. This action overwrites
and destroys any breadcrumbs that a user may have pre-populated on the event before it
was captured. The previous implementation would have preserved these existing
breadcrumbs, as it only appended scope breadcrumbs if they were present. This change
introduces a regression that causes the loss of user-provided data in a configuration
intended to ignore new breadcrumbs, not clear existing ones.

Description
This adds the scope merging mechanism by allocating a
captureStateobject and copying all needed event attributes in place. This removes taking multiple scope clones on every capture.The PR also includes breaking changes around
EventModifier. TheEventModifierwas an agnostic modifier that was passed onApplyToEvent. This duplicated the EventProcessor behavior and also complicated the scope merging mechanism, since we need to have a concrete*Scopetype to merge the scopes. Furthermore, there is no documented behavior or signature for anyEventModifierand this seems to be just the first archaic way to modify events beforeEventProcessorandBeforeSendhooks where a thing. Thus decided to remove this and have a concrete*Scopepassed onApplyToEvent. This behavior aligns with other sdks that pass a concrete scope.This affects the public API with all the
CaptureXmethods now requiring a concrete scope to be passed, but further scope changes in the stack also change theCaptureXAPIs to work withcontext.Context, so this change seems acceptable. Functionality isn't really removed but just shifted toBeforeSendhooks as intended.Issues
Changelog Entry Instructions
To add a custom changelog entry, uncomment the section above. Supports:
For more details: custom changelog entries
Reminders
feat:,fix:,ref:,meta:)