Skip to content

Commit 9209221

Browse files
shruthilayajChristinarlong
authored andcommitted
chore: disable low accuracy tooltips if sample rate is 100 (#89202)
1 parent 455f509 commit 9209221

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {defined} from 'sentry/utils';
88

99
type Props = {
1010
confidence?: Confidence;
11+
isSampled?: boolean | null;
1112
sampleCount?: number;
1213
topEvents?: number;
1314
};
@@ -16,14 +17,16 @@ export function ConfidenceFooter(props: Props) {
1617
return <Container>{confidenceMessage(props)}</Container>;
1718
}
1819

19-
function confidenceMessage({sampleCount, confidence, topEvents}: Props) {
20+
function confidenceMessage({sampleCount, confidence, topEvents, isSampled}: Props) {
2021
const isTopN = defined(topEvents) && topEvents > 0;
2122
if (!defined(sampleCount)) {
2223
return isTopN
2324
? t('* Chart for top %s groups extrapolated from \u2026', topEvents)
2425
: t('* Chart extrapolated from \u2026');
2526
}
2627

28+
const noSampling = defined(isSampled) && !isSampled;
29+
2730
const lowAccuracySampleCount = (
2831
<Tooltip
2932
title={
@@ -41,6 +44,7 @@ function confidenceMessage({sampleCount, confidence, topEvents}: Props) {
4144
)}
4245
</div>
4346
}
47+
disabled={noSampling}
4448
maxWidth={270}
4549
>
4650
<InsufficientSamples>

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,10 @@ export function ExploreCharts({
144144

145145
const {data, error, loading} = getSeries(dedupedYAxes, formattedYAxes);
146146

147-
const {sampleCount} = determineSeriesSampleCountAndIsSampled(data, isTopN);
147+
const {sampleCount, isSampled} = determineSeriesSampleCountAndIsSampled(
148+
data,
149+
isTopN
150+
);
148151

149152
return {
150153
chartIcon: <IconGraph type={chartIcon} />,
@@ -157,6 +160,7 @@ export function ExploreCharts({
157160
loading,
158161
confidence: confidences[index],
159162
sampleCount,
163+
isSampled,
160164
};
161165
});
162166
}, [confidences, getSeries, visualizes, isTopN]);
@@ -307,6 +311,7 @@ export function ExploreCharts({
307311
dataset === DiscoverDatasets.SPANS_EAP_RPC && (
308312
<ConfidenceFooter
309313
sampleCount={chartInfo.sampleCount}
314+
isSampled={chartInfo.isSampled}
310315
confidence={chartInfo.confidence}
311316
topEvents={
312317
topEvents ? Math.min(topEvents, chartInfo.data.length) : undefined

static/app/views/explore/multiQueryMode/queryVisualizations/chart.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export function MultiQueryModeChart({
133133
]);
134134

135135
const {data, error, loading} = getSeries();
136-
const {sampleCount} = determineSeriesSampleCountAndIsSampled(data, isTopN);
136+
const {sampleCount, isSampled} = determineSeriesSampleCountAndIsSampled(data, isTopN);
137137

138138
const visualizationType =
139139
queryParts.chartType === ChartType.LINE
@@ -327,6 +327,7 @@ export function MultiQueryModeChart({
327327
<ConfidenceFooter
328328
sampleCount={sampleCount}
329329
confidence={confidence}
330+
isSampled={isSampled}
330331
topEvents={isTopN ? numSeries : undefined}
331332
/>
332333
}

0 commit comments

Comments
 (0)