Skip to content

Conversation

@narsaynorath
Copy link
Member

@narsaynorath narsaynorath commented Dec 8, 2025

This begins adding the traceMetrics dataset 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 dataset button appears
  • When selecting the dataset, the visualize bars load the first metric and selects it, as well as auto-selects the first applicable aggregate
  • Users can add more metrics to compare
  • Users can filter metrics
  • Users can add a group by
  • Users can save and edit a widget

The functionality that needs to be iterated on (i.e. not complete in this PR) are:

  • Decide how to restrict when users can query different metrics (e.g. filters across different metrics can't be applied the same way we do other datasets)
  • Group by should be restricted to the metrics selected
  • Adding an alias needs to work
  • Handle starting state/empty state better before we've loaded metrics
  • Fix bug preventing us from using the new timeseries visualization
  • Implement confidence footer

@narsaynorath narsaynorath requested review from a team as code owners December 8, 2025 16:35
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Dec 8, 2025
@narsaynorath narsaynorath marked this pull request as draft December 8, 2025 16:39
@codecov
Copy link

codecov bot commented Dec 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

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              

field.kind as FieldValueKind
)
let aggregates = [];
if ((state.yAxis?.length ?? 0) > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

aggregateOptions,
dispatch,
index,
state.yAxis,
Copy link
Contributor

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.

Copy link
Member Author

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.

Comment on lines +24 to +25
field: QueryFieldValue;
index: number;
Copy link
Contributor

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?

Copy link
Member Author

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

@narsaynorath narsaynorath merged commit 67392c2 into master Dec 10, 2025
48 checks passed
@narsaynorath narsaynorath deleted the nar/feat/tracemetrics-add-dataset-to-dashboards branch December 10, 2025 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants