Skip to content

Commit

Permalink
fix(alerts): Updates alerts y axis duration formatting to show decima…
Browse files Browse the repository at this point in the history
…ls (#82022)

Updates the Duration Y Axis labels in Alerts charts to render with
dynamic decimals. This resolves an issue where Y Axis Duration Labels
with close enough values end up rounding to the same displayed value.
  • Loading branch information
edwardgou-sentry authored Dec 12, 2024
1 parent d78f4c7 commit cdfa7cf
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions static/app/views/alerts/utils/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import toArray from 'sentry/utils/array/toArray';
import {getUtcDateString} from 'sentry/utils/dates';
import {axisLabelFormatter, tooltipFormatter} from 'sentry/utils/discover/charts';
import {aggregateOutputType} from 'sentry/utils/discover/fields';
import {formatMetricUsingFixedUnit} from 'sentry/utils/metrics/formatters';
import {
formatMetricUsingFixedUnit,
formatMetricUsingUnit,
} from 'sentry/utils/metrics/formatters';
import {parseField, parseMRI} from 'sentry/utils/metrics/mri';
import {
Dataset,
Expand Down Expand Up @@ -142,7 +145,13 @@ export function alertAxisFormatter(value: number, seriesName: string, aggregate:
return formatMetricUsingFixedUnit(value, unit, aggregation);
}

return axisLabelFormatter(value, aggregateOutputType(seriesName));
const type = aggregateOutputType(seriesName);

if (type === 'duration') {
return formatMetricUsingUnit(value, 'milliseconds');
}

return axisLabelFormatter(value, type);
}

export function alertTooltipValueFormatter(
Expand Down

0 comments on commit cdfa7cf

Please sign in to comment.