Conversation
…d multi-aggregate widgets When WidgetType.ERRORS was added to the new VisualizationWidget rendering path, legend labels became duplicated because transformWidgetSeriesToTimeSeries recomputed labels from the TimeSeries structure and lost query association. Two fixes: - Multi-query without aliases: widget query hooks now prefix series names with prettified query conditions via labelSeriesForLegend, since hooks know which query produced each series. - Multi-aggregate with group by: changed columns.length > 1 to > 0 so the yAxis is appended for uniqueness with any group-by column. DAIN-1305
Split labelSeriesForLegend into two focused utilities: - getSeriesQueryPrefix: returns the prefix for a query's series - prettifyQueryConditions: converts internal wildcard operator markers back to user-facing syntax (*value*, value*, *value) Rename getSeriesNamePrefix to getSeriesQueryPrefix and update hooks to apply the prefix inline instead of creating new Series objects. Revert transformWidgetSeriesToTimeSeries to its original query resolution logic (alias-based matching with firstQuery fallback). DAIN-1305 Co-Authored-By: Claude <noreply@anthropic.com>
static/app/views/dashboards/widgetCard/transformWidgetSeriesToTimeSeries.tsx
Outdated
Show resolved
Hide resolved
Accept upstream named export rename of useApi alongside our SERIES_NAME_PART_DELIMITER import.
static/app/views/dashboards/widgetCard/transformWidgetSeriesToTimeSeries.tsx
Outdated
Show resolved
Hide resolved
static/app/views/dashboards/widgetCard/transformWidgetSeriesToTimeSeries.tsx
Outdated
Show resolved
Hide resolved
Use SERIES_QUERY_DELIMITER (' > ') to separate the query prefix from
the rest of the series name, matching the existing convention in
transformEventsResponseToSeries for alias + group-by series.
This makes parsing robust: transformWidgetSeriesToTimeSeries checks
for ' > ' to extract the query prefix, instead of heuristically
guessing which part of a ' : '-delimited name is the prefix vs a
group-by value.
Also fixes a bug where group-by values (e.g., "prod") in multi-query
widgets with empty conditions were misidentified as query names.
DAIN-1305
Co-Authored-By: Claude <noreply@anthropic.com>
…T_DELIMITER Move SERIES_QUERY_DELIMITER to transformLegacySeriesToTimeSeries.tsx so both series name delimiter constants are defined side by side. DAIN-1305 Co-Authored-By: Claude <noreply@anthropic.com>
DominikB2014
approved these changes
Mar 18, 2026
Member
Author
|
@DominikB2014 totally, it's a tough problem though because in a Dashboards context we are sending multiple queries out that all return the same aggregations, so we either have to somehow attach that information to the aggregates themselves or keep track of the queries, both of which are yucky! I will definitely revisit this soon |
Accept upstream named export rename of RequestError alongside our SERIES_QUERY_DELIMITER import.
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
static/app/views/dashboards/widgetCard/transformWidgetSeriesToTimeSeries.tsx
Show resolved
Hide resolved
Compute the split of unprefixedName once and reuse it for both yAxis lookup and passing to transformLegacySeriesToTimeSeries. Reuses splitSeriesName when there's no query prefix delimiter. DAIN-1305 Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Imagine you add two filters for one chart with a group by:

Before:

After:

We weren't disambiguating the legends at all between the two filters! With this PR, if the queries don't have any aliases we prefix each series by the query that filtered it, so at least the items are all kept separate.
Fix 1: Widget query hooks now call
getSeriesQueryPrefixaftertransformSeriesto prefix series names with prettified query conditions when there are multiple queries and no alias. This happens in the hooks (not the visualization component) because the hooks iterate per-query and know which query produced each series — by the time series reach the visualization layer, they're a flat array with no query association.Fix 2: Changed
columns.length > 1tocolumns.length > 0intransformWidgetSeriesToTimeSeriesso the yAxis is appended whenever there's at least one group-by column.This is all destined to be updated very soon when we start using
/events-timeseries/in the Dashboard fetchers, sinceTimeSeriesobjects preserve more context and we'll be able to consolidate all this formatting.Fixes DAIN-1305