Skip to content

feat(tracemetrics): Convert equation alias to full equation for queries#116047

Merged
narsaynorath merged 9 commits into
masterfrom
nar/feat/tracemetrics-dashboards-represent-equations-in-full-form
May 25, 2026
Merged

feat(tracemetrics): Convert equation alias to full equation for queries#116047
narsaynorath merged 9 commits into
masterfrom
nar/feat/tracemetrics-dashboards-represent-equations-in-full-form

Conversation

@narsaynorath
Copy link
Copy Markdown
Member

@narsaynorath narsaynorath commented May 21, 2026

The RPC endpoint for tracemetrics doesn't take equation[0] as a valid sort and expects the full equation|... format. This PR ensures that when we make requests to the datasets with sorts (e.g. grouped series, or categorical bar charts) that the full equation is used.

This is done by updating two surfaces:

  • Updating the series query params to treat DiscoverDatasets.TRACEMETRICS similar to spans and logs, which use RPC and have the same constraints/handling
  • Update the table request for categorical bar charts to detect if the sort is an equation alias, then get the index, get the equations, and use the right equation index to set the sort
  • Remove equation handling for the widget builder table sort because all datasets that support equations now support the full equation format. It's only the case that some datasets (RPC datasets) don't support the alias format

This shouldn't require feature-flagging because it's gated on having the equation builder, which itself is feature flagged.

I did a bunch of this PR manually and guided with claude before I realized there was a lot simpler of an implementation where we can internally use the equation[0] syntax for now and convert on the requests. At that point I prompted it to remove a bunch of the old cruft, rework the stuff that remained, and add tests.

@narsaynorath narsaynorath requested a review from a team as a code owner May 21, 2026 19:46
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 21, 2026

📊 Type Coverage Diff

✅ No new type safety issues introduced. Coverage: 93.58%

Comment thread static/app/views/dashboards/widgetCard/hooks/useTraceMetricsWidgetQuery.tsx Outdated
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

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 2 potential issues.

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 c03cb74. Configure here.

Comment thread static/app/components/modals/dataWidgetViewerModal.tsx Outdated
Copy link
Copy Markdown
Contributor

@DominikB2014 DominikB2014 left a comment

Choose a reason for hiding this comment

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

lgtm! just small nit to use a utility function for dealing with sorts

Comment thread static/app/views/dashboards/widgetCard/hooks/useTraceMetricsWidgetQuery.tsx Outdated
Comment thread static/app/views/dashboards/widgetCard/hooks/useTraceMetricsWidgetQuery.tsx Outdated
Comment thread static/app/views/dashboards/widgetCard/hooks/useTraceMetricsWidgetQuery.tsx Outdated
Comment thread static/app/views/dashboards/widgetCard/hooks/useTraceMetricsWidgetQuery.tsx Outdated
Comment thread static/app/components/modals/dataWidgetViewerModal.tsx
@narsaynorath narsaynorath merged commit f05d511 into master May 25, 2026
71 checks passed
@narsaynorath narsaynorath deleted the nar/feat/tracemetrics-dashboards-represent-equations-in-full-form branch May 25, 2026 16:26
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