-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
feat(tracemetrics): Add initial dataset implementation to dashboards #104518
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
feat(tracemetrics): Add initial dataset implementation to dashboards #104518
Conversation
static/app/views/dashboards/widgetBuilder/utils/convertBuilderStateToWidget.ts
Show resolved
Hide resolved
static/app/views/dashboards/widgetBuilder/hooks/useWidgetBuilderState.tsx
Show resolved
Hide resolved
...c/app/views/dashboards/widgetBuilder/components/visualize/traceMetrics/aggregateSelector.tsx
Show resolved
Hide resolved
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #104518 +/- ##
===========================================
- Coverage 80.51% 80.51% -0.01%
===========================================
Files 9347 9347
Lines 399873 399829 -44
Branches 25651 25639 -12
===========================================
- Hits 321962 321925 -37
+ Misses 77463 77456 -7
Partials 448 448 |
static/app/views/dashboards/widgetBuilder/hooks/useWidgetBuilderState.tsx
Show resolved
Hide resolved
static/app/views/dashboards/widgetBuilder/components/visualize/traceMetrics/metricSelectRow.tsx
Show resolved
Hide resolved
static/app/views/dashboards/widgetBuilder/hooks/useWidgetBuilderState.tsx
Show resolved
Hide resolved
static/app/views/dashboards/widgetBuilder/utils/convertBuilderStateToWidget.ts
Show resolved
Hide resolved
static/app/views/dashboards/widgetBuilder/utils/convertBuilderStateToWidget.ts
Outdated
Show resolved
Hide resolved
| field.kind as FieldValueKind | ||
| ) | ||
| let aggregates = []; | ||
| if ((state.yAxis?.length ?? 0) > 0) { |
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.
| if ((state.yAxis?.length ?? 0) > 0) { | |
| if (state.yAxis?.length) { |
I think this also works because a length of 0 is falsy. This should also let you get rid of some of the optional chaining on yaxis? and the coalesce.
static/app/views/dashboards/widgetBuilder/components/visualize/traceMetrics/metricSelectRow.tsx
Outdated
Show resolved
Hide resolved
...c/app/views/dashboards/widgetBuilder/components/visualize/traceMetrics/aggregateSelector.tsx
Outdated
Show resolved
Hide resolved
| aggregateOptions, | ||
| dispatch, | ||
| index, | ||
| state.yAxis, |
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.
any issues if we're dispatching SET_Y_AXIS actions within the effect with state.yAxis as a dependancy? Not entirely sure myself.
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.
You're right, it's a little tricky to do this but in this case it's okay since it only fires the dispatch if there's an aggregate that needs to be forced to a correct/valid state, which in that case it makes sense it should also run when state.yAxis changes
This is kind of a workaround right now for how the metric gets added. I'm using the weird sentinel value which assigns avg(value,,,), so when you add a metric, there's an async request to load them in and then stuff gets reset properly with these effects. I should revisit if I can avoid this because it's a little unclear what's happening but until I rip the querying out of the aggregate selector, we'll have to do it this way.
| field: QueryFieldValue; | ||
| index: number; |
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.
question whats the difference between field and state.yAxis[index]? Do they point to the same QueryFieldValue?
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.
Since updating the yAxes takes an array, the index here serves to indicate which field to update. i.e. the field passed in is all good for rendering, but it doesn't point exactly to which yAxis to change when doing the update. I suppose I could do a referential check with axis === field, but I'm slightly worried about it causing a subtle bug.
Worth noting to tidy up though, I can see why this raises questions
This begins adding the
traceMetricsdataset to Dashboards. This is still a WIP and different aspects of Metrics in dashboards still need iteration before being feature complete and releasable.The functionality captured here are:
The functionality that needs to be iterated on (i.e. not complete in this PR) are: