Skip to content

fix(metrics): Add group by attribute fallback#116763

Merged
nsdeschenes merged 4 commits into
masterfrom
nd/chore-metrics-fallback-to-item-details
Jun 3, 2026
Merged

fix(metrics): Add group by attribute fallback#116763
nsdeschenes merged 4 commits into
masterfrom
nd/chore-metrics-fallback-to-item-details

Conversation

@nsdeschenes

@nsdeschenes nsdeschenes commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Adding in a fallback to the metrics group by selector to pull in data from the first trace item detail.

nsdeschenes and others added 2 commits June 3, 2026 08:47
Fetch the first metric sample and use its trace item details to supplement group by options when the attributes endpoint misses fields.

Keep the attributes endpoint as the primary source on duplicate keys and keep the selector disabled until the fallback flow finishes.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
Add toolbar coverage for merging fallback trace item attributes, pretty labels, filtered attributes, loading state, and the equation path.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 3, 2026
@nsdeschenes

Copy link
Copy Markdown
Contributor Author

@sentry review

@nsdeschenes

Copy link
Copy Markdown
Contributor Author

@cursor review

@nsdeschenes nsdeschenes marked this pull request as ready for review June 3, 2026 13:09
@nsdeschenes nsdeschenes requested a review from a team as a code owner June 3, 2026 13:09

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(talked 1:1, Nick will look at more things)

}).filter(([key]) => !HiddenTraceMetricGroupByFields.includes(key))
);
}, [data?.booleanAttributes]);
}, [data?.booleanAttributes, fallbackAttributes.booleanAttributes]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[Refactor] I would dedupe these three nearly-identical useMemo calls. It's just past WET and there's a fair amount of syntax.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 5eb2196. Configure here.

enabled &&
(sampleResult.result.isFetching ||
!sampleResult.result.isFetched ||
(canFetchTraceDetails && traceDetailsResult.isLoading)),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Group by disables on refetch

Medium Severity

isFallbackLoading treats any in-flight metric-samples request as loading, including background refetches after data is already present. The group-by control stays disabled (and shows loading) whenever isFetching is true, so users can be blocked from changing group-bys after options were already merged.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 5eb2196. Configure here.

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Confirmed this fixes things. Nice!

Just one suggestion, definitely not a blocker at all.

Image

@nsdeschenes nsdeschenes merged commit 91bd0ef into master Jun 3, 2026
76 checks passed
@nsdeschenes nsdeschenes deleted the nd/chore-metrics-fallback-to-item-details branch June 3, 2026 13:47
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.

2 participants