Skip to content

Commit 391f1c2

Browse files
authored
chore(explore): Remove progressive loading normal mode flag (#91264)
We should be using the normal -> high accuracy strategy by default now.
1 parent 2742db0 commit 391f1c2

16 files changed

+57
-338
lines changed

static/app/views/alerts/rules/metric/details/metricChart.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -453,18 +453,14 @@ export default function MetricChart({
453453
]
454454
);
455455

456-
const isUsingNormalSamplingMode = organization.features.includes(
457-
'visibility-explore-progressive-loading-normal-sampling-mode'
458-
);
459-
460456
const {data: eventStats, isLoading: isLoadingEventStats} = useMetricEventStats(
461457
{
462458
project,
463459
rule,
464460
timePeriod,
465461
referrer: 'api.alerts.alert-rule-chart',
466462
samplingMode:
467-
isUsingNormalSamplingMode && rule.dataset === Dataset.EVENTS_ANALYTICS_PLATFORM
463+
rule.dataset === Dataset.EVENTS_ANALYTICS_PLATFORM
468464
? SAMPLING_MODE.NORMAL
469465
: undefined,
470466
},

static/app/views/alerts/rules/metric/triggers/chart/index.spec.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,11 +256,7 @@ describe('Incident Rules Create', () => {
256256
});
257257

258258
it('uses normal sampling for span alerts', async () => {
259-
const {organization, project, router} = initializeOrg({
260-
organization: {
261-
features: ['visibility-explore-progressive-loading-normal-sampling-mode'],
262-
},
263-
});
259+
const {organization, project, router} = initializeOrg();
264260

265261
render(
266262
<TriggersChart

static/app/views/alerts/rules/metric/triggers/chart/index.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -714,10 +714,6 @@ class TriggersChart extends PureComponent<Props, State> {
714714
partial: false,
715715
};
716716

717-
const isUsingNormalSamplingMode = organization.features.includes(
718-
'visibility-explore-progressive-loading-normal-sampling-mode'
719-
);
720-
721717
return (
722718
<Fragment>
723719
{this.props.includeHistorical ? (
@@ -751,7 +747,7 @@ class TriggersChart extends PureComponent<Props, State> {
751747
period={period}
752748
dataLoadedCallback={onDataLoaded}
753749
sampling={
754-
isUsingNormalSamplingMode && dataset === Dataset.EVENTS_ANALYTICS_PLATFORM
750+
dataset === Dataset.EVENTS_ANALYTICS_PLATFORM
755751
? SAMPLING_MODE.NORMAL
756752
: undefined
757753
}

static/app/views/dashboards/widgetCard/spansWidgetQueries.spec.tsx

Lines changed: 24 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import {OrganizationFixture} from 'sentry-fixture/organization';
21
import {PageFiltersFixture} from 'sentry-fixture/pageFilters';
32
import {WidgetFixture} from 'sentry-fixture/widget';
43

4+
import {initializeOrg} from 'sentry-test/initializeOrg';
55
import {render, screen} from 'sentry-test/reactTestingLibrary';
66

77
import {DisplayType} from 'sentry/views/dashboards/types';
8-
import {OrganizationContext} from 'sentry/views/organizationContext';
98

109
import SpansWidgetQueries from './spansWidgetQueries';
1110

1211
describe('spansWidgetQueries', () => {
12+
const {organization} = initializeOrg();
1313
const api = new MockApiClient();
1414
let widget = WidgetFixture();
1515
const selection = PageFiltersFixture();
@@ -127,23 +127,18 @@ describe('spansWidgetQueries', () => {
127127
});
128128

129129
render(
130-
<OrganizationContext.Provider
131-
value={OrganizationFixture({
132-
features: ['visibility-explore-progressive-loading-normal-sampling-mode'],
133-
})}
130+
<SpansWidgetQueries
131+
api={api}
132+
widget={widget}
133+
selection={{
134+
...selection,
135+
datetime: {period: '24hr', end: null, start: null, utc: null},
136+
}}
137+
dashboardFilters={{}}
134138
>
135-
<SpansWidgetQueries
136-
api={api}
137-
widget={widget}
138-
selection={{
139-
...selection,
140-
datetime: {period: '24hr', end: null, start: null, utc: null},
141-
}}
142-
dashboardFilters={{}}
143-
>
144-
{({timeseriesResults}) => <div>{timeseriesResults?.[0]?.data?.[0]?.value}</div>}
145-
</SpansWidgetQueries>
146-
</OrganizationContext.Provider>
139+
{({timeseriesResults}) => <div>{timeseriesResults?.[0]?.data?.[0]?.value}</div>}
140+
</SpansWidgetQueries>,
141+
{organization}
147142
);
148143

149144
expect(await screen.findByText('1')).toBeInTheDocument();
@@ -186,23 +181,18 @@ describe('spansWidgetQueries', () => {
186181
});
187182

188183
render(
189-
<OrganizationContext.Provider
190-
value={OrganizationFixture({
191-
features: ['visibility-explore-progressive-loading-normal-sampling-mode'],
192-
})}
184+
<SpansWidgetQueries
185+
api={api}
186+
widget={widget}
187+
selection={{
188+
...selection,
189+
datetime: {period: '24hr', end: null, start: null, utc: null},
190+
}}
191+
dashboardFilters={{}}
193192
>
194-
<SpansWidgetQueries
195-
api={api}
196-
widget={widget}
197-
selection={{
198-
...selection,
199-
datetime: {period: '24hr', end: null, start: null, utc: null},
200-
}}
201-
dashboardFilters={{}}
202-
>
203-
{({tableResults}) => <div>{tableResults?.[0]?.data?.[0]?.a}</div>}
204-
</SpansWidgetQueries>
205-
</OrganizationContext.Provider>
193+
{({tableResults}) => <div>{tableResults?.[0]?.data?.[0]?.a}</div>}
194+
</SpansWidgetQueries>,
195+
{organization}
206196
);
207197

208198
expect(await screen.findByText('normal mode')).toBeInTheDocument();

static/app/views/dashboards/widgetCard/spansWidgetQueries.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,7 @@ function SpansWidgetQueriesSingleRequestImpl({
151151
dashboardFilters={dashboardFilters}
152152
onDataFetched={onDataFetched}
153153
afterFetchSeriesData={afterFetchSeriesData}
154-
samplingMode={
155-
organization.features.includes(
156-
'visibility-explore-progressive-loading-normal-sampling-mode'
157-
)
158-
? SAMPLING_MODE.NORMAL
159-
: undefined
160-
}
154+
samplingMode={SAMPLING_MODE.NORMAL}
161155
>
162156
{props =>
163157
children({

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

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -44,48 +44,6 @@ describe('ConfidenceFooter', () => {
4444
await screen.findByText(/You may not have enough samples for high accuracy./)
4545
).toBeInTheDocument();
4646
});
47-
it('renders for partial scan without grouping', async () => {
48-
render(
49-
<ConfidenceFooter
50-
confidence="low"
51-
sampleCount={100}
52-
topEvents={undefined}
53-
dataScanned="partial"
54-
/>,
55-
{wrapper: Wrapper}
56-
);
57-
58-
expect(screen.getByTestId('wrapper')).toHaveTextContent(
59-
'Based on 100 samples (Max. Limit)'
60-
);
61-
await userEvent.hover(screen.getByText('100'));
62-
expect(
63-
await screen.findByText(
64-
/We could not scan all available data due to time or resource limits./
65-
)
66-
).toBeInTheDocument();
67-
});
68-
it('renders for partial scan with grouping', async () => {
69-
render(
70-
<ConfidenceFooter
71-
confidence="low"
72-
sampleCount={100}
73-
topEvents={5}
74-
dataScanned="partial"
75-
/>,
76-
{wrapper: Wrapper}
77-
);
78-
79-
expect(screen.getByTestId('wrapper')).toHaveTextContent(
80-
'Top 5 groups based on 100 samples (Max. Limit)'
81-
);
82-
await userEvent.hover(screen.getByText('100'));
83-
expect(
84-
await screen.findByText(
85-
/We could not scan all available data due to time or resource limits./
86-
)
87-
).toBeInTheDocument();
88-
});
8947
});
9048

9149
describe('high confidence', () => {
@@ -117,47 +75,5 @@ describe('ConfidenceFooter', () => {
11775
'Top 5 groups based on 100 samples'
11876
);
11977
});
120-
it('renders for partial scan without grouping', async () => {
121-
render(
122-
<ConfidenceFooter
123-
confidence="high"
124-
sampleCount={100}
125-
topEvents={undefined}
126-
dataScanned="partial"
127-
/>,
128-
{wrapper: Wrapper}
129-
);
130-
131-
expect(screen.getByTestId('wrapper')).toHaveTextContent(
132-
'Based on 100 samples (Max. Limit)'
133-
);
134-
await userEvent.hover(screen.getByText('100'));
135-
expect(
136-
await screen.findByText(
137-
/We could not scan all available data due to time or resource limits./
138-
)
139-
).toBeInTheDocument();
140-
});
141-
it('renders for partial scan with grouping', async () => {
142-
render(
143-
<ConfidenceFooter
144-
confidence="high"
145-
sampleCount={100}
146-
topEvents={5}
147-
dataScanned="partial"
148-
/>,
149-
{wrapper: Wrapper}
150-
);
151-
152-
expect(screen.getByTestId('wrapper')).toHaveTextContent(
153-
'Top 5 groups based on 100 samples (Max. Limit)'
154-
);
155-
await userEvent.hover(screen.getByText('100'));
156-
expect(
157-
await screen.findByText(
158-
/We could not scan all available data due to time or resource limits./
159-
)
160-
).toBeInTheDocument();
161-
});
16278
});
16379
});

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

Lines changed: 2 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import Count from 'sentry/components/count';
55
import {t, tct} from 'sentry/locale';
66
import type {Confidence} from 'sentry/types/organization';
77
import {defined} from 'sentry/utils';
8-
import useOrganization from 'sentry/utils/useOrganization';
98

109
type Props = {
1110
confidence?: Confidence;
@@ -16,23 +15,10 @@ type Props = {
1615
};
1716

1817
export function ConfidenceFooter(props: Props) {
19-
const organization = useOrganization();
20-
const normalSamplingModeEnabled = organization.features.includes(
21-
'visibility-explore-progressive-loading-normal-sampling-mode'
22-
);
23-
return (
24-
<Container>{confidenceMessage({...props, normalSamplingModeEnabled})}</Container>
25-
);
18+
return <Container>{confidenceMessage(props)}</Container>;
2619
}
2720

28-
function confidenceMessage({
29-
sampleCount,
30-
confidence,
31-
topEvents,
32-
isSampled,
33-
dataScanned,
34-
normalSamplingModeEnabled,
35-
}: Props & {normalSamplingModeEnabled: boolean}) {
21+
function confidenceMessage({sampleCount, confidence, topEvents, isSampled}: Props) {
3622
const isTopN = defined(topEvents) && topEvents > 1;
3723
if (!defined(sampleCount)) {
3824
return isTopN
@@ -42,24 +28,10 @@ function confidenceMessage({
4228

4329
const noSampling = defined(isSampled) && !isSampled;
4430

45-
const partialScanTooltip = <_PartialScanTooltip />;
4631
const lowAccuracyFullSampleCount = <_LowAccuracyFullTooltip noSampling={noSampling} />;
4732
const sampleCountComponent = <Count value={sampleCount} />;
48-
const showPartialScanMessage = dataScanned === 'partial' && !normalSamplingModeEnabled;
49-
5033
if (confidence === 'low') {
5134
if (isTopN) {
52-
if (showPartialScanMessage) {
53-
return tct(
54-
'Top [topEvents] groups based on [tooltip:[sampleCountComponent] samples (Max. Limit)]',
55-
{
56-
topEvents,
57-
tooltip: partialScanTooltip,
58-
sampleCountComponent,
59-
}
60-
);
61-
}
62-
6335
return tct(
6436
'Top [topEvents] groups based on [tooltip:[sampleCountComponent] samples]',
6537
{
@@ -70,44 +42,19 @@ function confidenceMessage({
7042
);
7143
}
7244

73-
if (showPartialScanMessage) {
74-
return tct('Based on [tooltip:[sampleCountComponent] samples (Max. Limit)]', {
75-
tooltip: partialScanTooltip,
76-
sampleCountComponent,
77-
});
78-
}
79-
8045
return tct('Based on [tooltip:[sampleCountComponent] samples]', {
8146
tooltip: lowAccuracyFullSampleCount,
8247
sampleCountComponent,
8348
});
8449
}
8550

8651
if (isTopN) {
87-
if (showPartialScanMessage) {
88-
return tct(
89-
'Top [topEvents] groups based on [tooltip:[sampleCountComponent] samples (Max. Limit)]',
90-
{
91-
topEvents,
92-
tooltip: partialScanTooltip,
93-
sampleCountComponent,
94-
}
95-
);
96-
}
97-
9852
return tct('Top [topEvents] groups based on [sampleCountComponent] samples', {
9953
topEvents,
10054
sampleCountComponent,
10155
});
10256
}
10357

104-
if (showPartialScanMessage) {
105-
return tct('Based on [tooltip:[sampleCountComponent] samples (Max. Limit)]', {
106-
tooltip: partialScanTooltip,
107-
sampleCountComponent,
108-
});
109-
}
110-
11158
return tct('Based on [sampleCountComponent] samples', {
11259
sampleCountComponent,
11360
});
@@ -146,27 +93,6 @@ function _LowAccuracyFullTooltip({
14693
);
14794
}
14895

149-
function _PartialScanTooltip({children}: {children?: React.ReactNode}) {
150-
return (
151-
<Tooltip
152-
title={
153-
<div>
154-
{t('We could not scan all available data due to time or resource limits.')}
155-
<br />
156-
<br />
157-
{t(
158-
'Try reducing your time range or removing filters to get more accurate trends.'
159-
)}
160-
</div>
161-
}
162-
maxWidth={270}
163-
showUnderline
164-
>
165-
{children}
166-
</Tooltip>
167-
);
168-
}
169-
17096
const Container = styled('span')`
17197
color: ${p => p.theme.subText};
17298
font-size: ${p => p.theme.fontSizeSmall};

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ describe('ExploreCharts', () => {
3737
dataset={DiscoverDatasets.SPANS_EAP}
3838
/>,
3939
{
40-
organization: OrganizationFixture({
41-
features: ['visibility-explore-progressive-loading-normal-sampling-mode'],
42-
}),
40+
organization: OrganizationFixture(),
4341
}
4442
);
4543

0 commit comments

Comments
 (0)