Skip to content
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

fix(profiling): fix measurement chart messaging #65237

Merged
merged 4 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading