fix(tracemetrics): Resolve all equations at once when subcomponents update#113117
Open
narsaynorath wants to merge 5 commits intomasterfrom
Open
fix(tracemetrics): Resolve all equations at once when subcomponents update#113117narsaynorath wants to merge 5 commits intomasterfrom
narsaynorath wants to merge 5 commits intomasterfrom
Conversation
Member
Author
|
@cursor review |
Contributor
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 042c595. Configure here.
Fixes a small bug revealed when testing the sync, some state changes would cause invalid equations and then fail to sync
…e' of github.com:getsentry/sentry into nar/fix/tracemetrics-resync-all-metric-queries-on-change
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.
Pretend you have equations A + 1, and 1 / A, the previous code was only updating 1 / A in response to A changing because each equation (i.e. ƒ1, ƒ2) was triggering its own navigate which would clobber previous updates, so ƒ1 would fire and cue up a navigate to update the equation, then ƒ2 would fire and cue up its own navigate, and when they were processed, only ƒ2 was shown to be updated (since the URL is parsed to determine the metric queries and the URL now only contained new ƒ2 state)
This PR adds in a sync functionality that batches up all of the metric query changes and dispatches a single
navigatecall. I had to extract some methods out into helpers to do this, which explains some of the larger diff.equationBuilder.tsxwas essentially renamed and nested under a folder so I could colocate utils from the old file.It removes the reference syncing responsibility from the equation builder and pushes it to the points where updates to metric queries happens. The effect of this is that we can update things in one go instead of as a side effect of something else changing.
Also snuck in a bug fix I found that was related to selecting different filter values. TLDR, there was a sequence of selecting filter values that if there was a space, the value would get double quotes, which was invalid for the grammar and wouldn't pass the
isValidcheck. I was trying to avoid having to do this but since it came up here and the fix was small I added it here. It replicates the grammar changes in #112962