Skip to content

Commit

Permalink
fix(profiling) use a int formatter for sample counts (#79621)
Browse files Browse the repository at this point in the history
Samples dont need float precision
  • Loading branch information
JonasBa authored Oct 23, 2024
1 parent 6bf9006 commit c5ee901
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import type {FlamegraphRenderer} from 'sentry/utils/profiling/renderers/flamegra
import {Rect} from 'sentry/utils/profiling/speedscope';
import {relativeChange} from 'sentry/utils/profiling/units/units';

const SAMPLES_FORMATTER = Intl.NumberFormat(undefined, {notation: 'compact'});

export function formatWeightToProfileDuration(
frame: CallTreeNode,
flamegraph: Flamegraph
Expand Down Expand Up @@ -109,7 +111,7 @@ function DifferentialFlamegraphTooltip(props: DifferentialFlamegraphTooltipProps
<FlamegraphTooltipColorIndicator
backgroundColor={formatColorForFrame(props.frame, props.flamegraphRenderer)}
/>
{flamegraph.formatter(props.frame.node.totalWeight)}{' '}
{SAMPLES_FORMATTER.format(props.frame.node.totalWeight)}{' '}
{t('samples, ') + formattedChange}{' '}
{`(${formatWeightToProfileDuration(props.frame.node, flamegraph)})`}{' '}
{props.frame.frame.name}
Expand Down Expand Up @@ -143,8 +145,7 @@ function AggregateFlamegraphTooltip(props: AggregateFlamegraphTooltipProps) {
<FlamegraphTooltipColorIndicator
backgroundColor={formatColorForFrame(props.frame, props.flamegraphRenderer)}
/>
{props.flamegraphRenderer.flamegraph.formatter(props.frame.node.totalWeight)}{' '}
{t('samples') + ' '}
{SAMPLES_FORMATTER.format(props.frame.node.totalWeight)} {t('samples') + ' '}
{`(${formatWeightToProfileDuration(
props.frame.node,
props.flamegraphRenderer.flamegraph
Expand Down

0 comments on commit c5ee901

Please sign in to comment.