-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
remove useTopNSpanSeries
http, mobile and queue module
#100453
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
Changes from all commits
b5384c5
94a459e
effed6d
3d79196
a9fddca
757b2b8
3bb820e
61c011d
1561aad
3bd85ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import {t} from 'sentry/locale'; | ||
import { | ||
getAggregateArg, | ||
getMeasurementSlug, | ||
maybeEquationAlias, | ||
stripEquationPrefix, | ||
} from 'sentry/utils/discover/fields'; | ||
import {formatVersion} from 'sentry/utils/versions/formatVersion'; | ||
import WidgetLegendNameEncoderDecoder from 'sentry/views/dashboards/widgetLegendNameEncoderDecoder'; | ||
import type {TimeSeries} from 'sentry/views/dashboards/widgets/common/types'; | ||
|
||
export function formatTimeSeriesLabel(timeSeries: TimeSeries): string { | ||
// If the timeSeries has `groupBy` information, the label is made by | ||
// concatenating the values of the groupBy, since there's no point repeating | ||
// the name of the Y axis multiple times in the legend. | ||
if (timeSeries.meta.isOther) { | ||
return t('Other'); | ||
} | ||
|
||
if (timeSeries.groupBy?.length && timeSeries.groupBy.length > 0) { | ||
return `${timeSeries.groupBy | ||
?.map(groupBy => { | ||
if (Array.isArray(groupBy.value)) { | ||
return JSON.stringify(groupBy.value); | ||
} | ||
|
||
if (groupBy.key === 'release') { | ||
return formatVersion(groupBy.value); | ||
} | ||
|
||
return groupBy.value; | ||
}) | ||
.join(',')}`; | ||
} | ||
|
||
let {yAxis: seriesName} = timeSeries; | ||
|
||
// Decode from series name disambiguation | ||
seriesName = WidgetLegendNameEncoderDecoder.decodeSeriesNameForLegend(seriesName)!; | ||
|
||
// Attempt to parse the `seriesName` as a version. A correct `TimeSeries` | ||
// would have a `yAxis` like `p50(span.duration)` with a `groupBy` like | ||
// `[{key: "release", value: "proj@1.2.3"}]`. `groupBy` was only introduced | ||
// recently though, so many `TimeSeries` instead mash the group by information | ||
// into the `yAxis` property, e.g., the `yAxis` might have been set to | ||
// `"proj@1.2.3"` just to get the correct rendering in the chart legend. We | ||
// cover these cases by parsing the `yAxis` as a series name. This works badly | ||
// because sometimes it'll interpet email addresses as versions, which causes | ||
// bugs. We should update all usages of `TimeSeriesWidgetVisualization` to | ||
// correctly specify `yAxis` and `groupBy`, and/or to use the time | ||
// `/events-timeseries` endpoint which does this automatically. | ||
seriesName = formatVersion(seriesName); | ||
|
||
// Check for special-case measurement formatting | ||
const arg = getAggregateArg(seriesName); | ||
if (arg) { | ||
const slug = getMeasurementSlug(arg); | ||
|
||
if (slug) { | ||
seriesName = slug.toUpperCase(); | ||
} | ||
} | ||
|
||
// Strip equation prefix | ||
if (maybeEquationAlias(seriesName)) { | ||
seriesName = stripEquationPrefix(seriesName); | ||
} | ||
|
||
return seriesName; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,15 @@ | ||
import {t} from 'sentry/locale'; | ||
import { | ||
getAggregateArg, | ||
getMeasurementSlug, | ||
maybeEquationAlias, | ||
stripEquationPrefix, | ||
} from 'sentry/utils/discover/fields'; | ||
import {formatVersion} from 'sentry/utils/versions/formatVersion'; | ||
import WidgetLegendNameEncoderDecoder from 'sentry/views/dashboards/widgetLegendNameEncoderDecoder'; | ||
import type {TimeSeries} from 'sentry/views/dashboards/widgets/common/types'; | ||
|
||
export function formatTimeSeriesName(timeSeries: TimeSeries): string { | ||
// If the timeSeries has `groupBy` information, the label is made by | ||
// concatenating the values of the groupBy, since there's no point repeating | ||
// the name of the Y axis multiple times in the legend. | ||
if (timeSeries.meta.isOther) { | ||
return t('Other'); | ||
} | ||
let name = `${timeSeries.yAxis}`; | ||
|
||
if (timeSeries.groupBy?.length && timeSeries.groupBy.length > 0) { | ||
return `${timeSeries.groupBy | ||
if (timeSeries.groupBy?.length) { | ||
name += ` : ${timeSeries.groupBy | ||
?.map(groupBy => { | ||
if (Array.isArray(groupBy.value)) { | ||
return JSON.stringify(groupBy.value); | ||
} | ||
|
||
if (groupBy.key === 'release') { | ||
return formatVersion(groupBy.value); | ||
} | ||
|
||
return groupBy.value; | ||
return `${groupBy.key} : ${groupBy.value}`; | ||
}) | ||
.join(',')}`; | ||
} | ||
|
||
let {yAxis: seriesName} = timeSeries; | ||
|
||
// Decode from series name disambiguation | ||
seriesName = WidgetLegendNameEncoderDecoder.decodeSeriesNameForLegend(seriesName)!; | ||
|
||
// Attempt to parse the `seriesName` as a version. A correct `TimeSeries` | ||
// would have a `yAxis` like `p50(span.duration)` with a `groupBy` like | ||
// `[{key: "release", value: "proj@1.2.3"}]`. `groupBy` was only introduced | ||
// recently though, so many `TimeSeries` instead mash the group by information | ||
// into the `yAxis` property, e.g., the `yAxis` might have been set to | ||
// `"proj@1.2.3"` just to get the correct rendering in the chart legend. We | ||
// cover these cases by parsing the `yAxis` as a series name. This works badly | ||
// because sometimes it'll interpet email addresses as versions, which causes | ||
// bugs. We should update all usages of `TimeSeriesWidgetVisualization` to | ||
// correctly specify `yAxis` and `groupBy`, and/or to use the time | ||
// `/events-timeseries` endpoint which does this automatically. | ||
seriesName = formatVersion(seriesName); | ||
|
||
// Check for special-case measurement formatting | ||
const arg = getAggregateArg(seriesName); | ||
if (arg) { | ||
const slug = getMeasurementSlug(arg); | ||
|
||
if (slug) { | ||
seriesName = slug.toUpperCase(); | ||
} | ||
} | ||
|
||
// Strip equation prefix | ||
if (maybeEquationAlias(seriesName)) { | ||
seriesName = stripEquationPrefix(seriesName); | ||
} | ||
|
||
return seriesName; | ||
return name; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ import type { | |
LegendSelection, | ||
TimeSeries, | ||
} from 'sentry/views/dashboards/widgets/common/types'; | ||
import {formatTimeSeriesName} from 'sentry/views/dashboards/widgets/timeSeriesWidget/formatters/formatTimeSeriesName'; | ||
import {Area} from 'sentry/views/dashboards/widgets/timeSeriesWidget/plottables/area'; | ||
import {Bars} from 'sentry/views/dashboards/widgets/timeSeriesWidget/plottables/bars'; | ||
import {Line} from 'sentry/views/dashboards/widgets/timeSeriesWidget/plottables/line'; | ||
|
@@ -134,10 +135,16 @@ export function InsightsTimeSeriesWidget(props: InsightsTimeSeriesWidgetProps) { | |
|
||
yAxes.add(timeSeries.yAxis); | ||
|
||
let alias = aliases?.[delayedTimeSeries.yAxis]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can't always rely on the |
||
const plottableName = formatTimeSeriesName(delayedTimeSeries); | ||
if (aliases?.[plottableName]) { | ||
alias = aliases?.[plottableName]; | ||
} | ||
|
||
return new PlottableDataConstructor(delayedTimeSeries, { | ||
color: COMMON_COLORS(theme)[delayedTimeSeries.yAxis], | ||
color: COMMON_COLORS(theme)[plottableName], | ||
stack: props.stacked && props.visualizationType === 'bar' ? 'all' : undefined, | ||
alias: aliases?.[delayedTimeSeries.yAxis], | ||
alias, | ||
}); | ||
}), | ||
...(props.extraPlottables ?? []), | ||
|
@@ -288,5 +295,7 @@ const COMMON_COLORS = (theme: Theme): Record<string, string> => { | |
'performance_score(measurements.score.inp)': vitalColors[2], | ||
'performance_score(measurements.score.cls)': vitalColors[3], | ||
'performance_score(measurements.score.ttfb)': vitalColors[4], | ||
'epm() : span.op : queue.publish': colors[1], | ||
'epm() : span.op : queue.process': colors[2], | ||
}; | ||
}; |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.