fix: apply per-event data via capture-local scope instead of mutating the global scope - #54
Draft
gradinarufelix wants to merge 1 commit into
Draft
Conversation
… the global scope captureThrowable() and captureMessage() previously wrote extras, tags, user and the session tag into the hub's scope permanently. In long-running CLI processes (queue workers) data from one capture leaked into all subsequent events: stale Reference Codes, exception_code tags and WithExtraDataInterface payloads. Per-event data is now applied inside withScope(), so it evaporates after each capture; the process-stable flow_version/flow_context tags remain on the global scope, set once at initialization.
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.
captureThrowable()andcaptureMessage()currently write per-event data (extras, tags, user, the session tag) into the hub's scope permanently viaconfigureScope(). In long-running CLI processes — queue workers in particular — data from one capture leaks into all subsequent events of the same process: stale Reference Codes,exception_codetags andWithExtraDataInterfacepayloads then decorate unrelated events, which actively misleads debugging.This applies per-event data inside
withScope()instead, so it evaporates after each capture. The process-stableflow_version/flow_contexttags remain on the global scope (set at initialization) and are additionally re-applied on the capture-local scope, preserving the previous behavior even when foreign code replaces or clears the hub scope.Draft while #52 is under discussion — no code dependency on it (applies cleanly to main), but review feedback there may affect naming here.