Skip to content

Commit

Permalink
fix(profiling): fix measurement chart messaging (#65237)
Browse files Browse the repository at this point in the history
Min renderable points is actually >1 and adjust messaging so we show the
upgrade message only if the profile has no measurements at all

---------

Co-authored-by: Tony Xiao <[email protected]>
Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 15, 2024
1 parent 7dba2dc commit 1fc95bd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
33 changes: 22 additions & 11 deletions static/app/components/profiling/flamegraph/flamegraphChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,26 @@ export function FlamegraphChart({
[configSpaceCursor, chartView]
);

let message = t('Profile has no measurements');
const canRenderChart = chart?.series.every(
s => s.points.length >= FlamegraphChartModel.MIN_RENDERABLE_POINTS
);

if (chart && !canRenderChart) {
const profileIsTooShortToDisplayMeasurements = chart.configSpace.width < 200 * 1e6;
const didNotCollectAnyMeasurements = chart.series.every(s => s.points.length === 0);

if (profileIsTooShortToDisplayMeasurements) {
message = t(
'Profile is too short to display measurements, minimum duration is at least 200ms'
);
}

if (didNotCollectAnyMeasurements) {
message = noMeasurementMessage || t('Profile has no measurements');
}
}

return (
<Fragment>
<Canvas
Expand All @@ -284,17 +304,8 @@ export function FlamegraphChart({
{/* transaction loads after profile, so we want to show loading even if it's in initial state */}
{profiles.type === 'loading' || profiles.type === 'initial' ? (
<CollapsibleTimelineLoadingIndicator />
) : profiles.type === 'resolved' && !chart?.series.length ? (
<CollapsibleTimelineMessage>
{noMeasurementMessage || t('Profile has no measurements')}
</CollapsibleTimelineMessage>
) : (chart?.series?.length ?? 0) > 0 &&
chart?.series.every(
s => s.points.length < FlamegraphChartModel.MIN_RENDERABLE_POINTS
) ? (
<CollapsibleTimelineMessage>
{noMeasurementMessage || t('Profile has no measurements')}
</CollapsibleTimelineMessage>
) : profiles.type === 'resolved' && !canRenderChart ? (
<CollapsibleTimelineMessage>{message}</CollapsibleTimelineMessage>
) : null}
</Fragment>
);
Expand Down
2 changes: 1 addition & 1 deletion static/app/utils/profiling/flamegraphChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class FlamegraphChart {
y: [0, 0],
};

static MIN_RENDERABLE_POINTS = 3;
static MIN_RENDERABLE_POINTS = 2;
static Empty = new FlamegraphChart(Rect.Empty(), [], [[0, 0, 0, 0]]);

constructor(
Expand Down

0 comments on commit 1fc95bd

Please sign in to comment.