-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
fix(tracemetrics): Validate aggregate sort bys for metrics #103555
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
fix(tracemetrics): Validate aggregate sort bys for metrics #103555
Conversation
| } | ||
|
|
||
| const baseVisualize = value.find(isBaseVisualize); | ||
| return baseVisualize ? Visualize.fromJSON(baseVisualize) : []; |
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.
Bug: Support for Multiple Visualizations Broken
The parseVisualizes function uses find() to get only the first BaseVisualize object from the array, discarding any additional visualizations. This breaks support for multiple visualizations that worked in the previous implementation which used filter().flatMap() to process all BaseVisualize objects.
| } | ||
|
|
||
| return !!value.name && !!value.type; | ||
| } |
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.
Bug: Refine isTraceMetric Validation for Null and Types
The isTraceMetric function crashes when value is null because typeof null === 'object' in JavaScript, causing line 27 to attempt property access on null which throws a TypeError. Additionally, the function incorrectly rejects valid TraceMetric objects with empty strings (like {name: '', type: ''} used in defaultMetricQuery) because !!'' evaluates to false. The checks should verify property types instead of truthiness and explicitly exclude null.
gggritso
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.
Makes sense overall, but those anys are a big liability, especially for any of them that parse URL data which could be null or whatever. Worth fixing IMO!
Thanks for the fix 🙏🏻
gggritso
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.
👍🏻
It was possible for the sort by not to be one of the selected fields.