Skip to content

Commit b372cd5

Browse files
authored
feat(explore): Update insufficient samples warning (#82132)
Simplify the designs a little by using the chart footer only instead of an alert on the top of the page.
1 parent 604f985 commit b372cd5

File tree

2 files changed

+26
-28
lines changed

2 files changed

+26
-28
lines changed

static/app/views/explore/charts/index.tsx

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import {
2020
prettifyParsedFunction,
2121
} from 'sentry/utils/discover/fields';
2222
import {DiscoverDatasets} from 'sentry/utils/discover/types';
23-
import {formatPercentage} from 'sentry/utils/number/formatPercentage';
2423
import {MutableSearch} from 'sentry/utils/tokenizeSearch';
2524
import usePageFilters from 'sentry/utils/usePageFilters';
2625
import usePrevious from 'sentry/utils/usePrevious';
@@ -353,24 +352,31 @@ export function ExploreCharts({query, setConfidence, setError}: ExploreChartsPro
353352
/>
354353
{dataset === DiscoverDatasets.SPANS_EAP_RPC && (
355354
<ChartFooter>
356-
{defined(extrapolationMetaResults.data?.[0]?.['count_sample()']) &&
357-
defined(
358-
extrapolationMetaResults.data?.[0]?.['avg_sample(sampling_rate)']
359-
)
360-
? tct(
361-
'*[sampleCount] samples extrapolated with an average sampling rate of [sampleRate]',
362-
{
355+
{!defined(extrapolationMetaResults.data?.[0]?.['count_sample()'])
356+
? t('* Extrapolated from \u2026')
357+
: resultConfidence === 'low'
358+
? tct('* Extrapolated from [insufficientSamples]', {
359+
insufficientSamples: (
360+
<Tooltip
361+
title={t(
362+
'Boost accuracy by shortening the date range, increasing the time interval or removing extra filters.'
363+
)}
364+
>
365+
<InsufficientSamples>
366+
{t('insufficient samples')}
367+
</InsufficientSamples>
368+
</Tooltip>
369+
),
370+
})
371+
: tct('* Extrapolated from [sampleCount] samples', {
363372
sampleCount: (
364373
<Count
365-
value={extrapolationMetaResults.data[0]['count_sample()']}
374+
value={
375+
extrapolationMetaResults.data?.[0]?.['count_sample()']
376+
}
366377
/>
367378
),
368-
sampleRate: formatPercentage(
369-
extrapolationMetaResults.data[0]['avg_sample(sampling_rate)']
370-
),
371-
}
372-
)
373-
: t('foo')}
379+
})}
374380
</ChartFooter>
375381
)}
376382
</ChartPanel>
@@ -401,7 +407,7 @@ function useExtrapolationMeta({
401407
const discoverQuery: NewQuery = {
402408
id: undefined,
403409
name: 'Explore - Extrapolation Meta',
404-
fields: ['count_sample()', 'avg_sample(sampling_rate)', 'min(sampling_rate)'],
410+
fields: ['count_sample()', 'min(sampling_rate)'],
405411
query: search.formatString(),
406412
version: 2,
407413
dataset,
@@ -455,3 +461,7 @@ const ChartFooter = styled('div')`
455461
margin-top: ${space(1.5)};
456462
margin-bottom: 0;
457463
`;
464+
465+
const InsufficientSamples = styled('span')`
466+
text-decoration: underline dotted ${p => p.theme.gray300};
467+
`;

static/app/views/explore/content.tsx

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,6 @@ function ExploreContentImpl({}: ExploreContentProps) {
114114
</Layout.HeaderActions>
115115
</Layout.Header>
116116
<Body>
117-
{confidence === 'low' && (
118-
<ConfidenceAlert type="warning" showIcon>
119-
{t(
120-
'Your low sample count may impact the accuracy of this extrapolation. Edit your query or increase your sample rate.'
121-
)}
122-
</ConfidenceAlert>
123-
)}
124117
<TopSection>
125118
<StyledPageFilterBar condensed>
126119
<ProjectPageFilter />
@@ -225,11 +218,6 @@ const Body = styled(Layout.Body)`
225218
}
226219
`;
227220

228-
const ConfidenceAlert = styled(Alert)`
229-
grid-column: 1/3;
230-
margin: 0;
231-
`;
232-
233221
const TopSection = styled('div')`
234222
display: grid;
235223
gap: ${space(2)};

0 commit comments

Comments
 (0)