Skip to content

Commit f70e42b

Browse files
authored
chore(explore): Remove dataset toolbar from explore (#89490)
The dataset toolbar is no longer needed so removing it here.
1 parent 4adc47b commit f70e42b

File tree

6 files changed

+37
-212
lines changed

6 files changed

+37
-212
lines changed

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

Lines changed: 9 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,11 @@ import {Tooltip} from 'sentry/components/tooltip';
77
import {IconClock, IconGraph} from 'sentry/icons';
88
import {t} from 'sentry/locale';
99
import {space} from 'sentry/styles/space';
10-
import type {Confidence, NewQuery} from 'sentry/types/organization';
10+
import type {Confidence} from 'sentry/types/organization';
1111
import {defined} from 'sentry/utils';
1212
import {dedupeArray} from 'sentry/utils/dedupeArray';
13-
import EventView from 'sentry/utils/discover/eventView';
1413
import {parseFunction, prettifyParsedFunction} from 'sentry/utils/discover/fields';
15-
import {DiscoverDatasets} from 'sentry/utils/discover/types';
1614
import {isTimeSeriesOther} from 'sentry/utils/timeSeries/isTimeSeriesOther';
17-
import {MutableSearch} from 'sentry/utils/tokenizeSearch';
18-
import usePageFilters from 'sentry/utils/usePageFilters';
1915
import usePrevious from 'sentry/utils/usePrevious';
2016
import {determineSeriesSampleCountAndIsSampled} from 'sentry/views/alerts/rules/metric/utils/determineSeriesSampleCount';
2117
import {WidgetSyncContextProvider} from 'sentry/views/dashboards/contexts/widgetSyncContext';
@@ -28,7 +24,6 @@ import {ConfidenceFooter} from 'sentry/views/explore/charts/confidenceFooter';
2824
import ChartContextMenu from 'sentry/views/explore/components/chartContextMenu';
2925
import {getProgressiveLoadingIndicator} from 'sentry/views/explore/components/progressiveLoadingIndicator';
3026
import {
31-
useExploreDataset,
3227
useExploreVisualizes,
3328
useSetExploreVisualizes,
3429
} from 'sentry/views/explore/contexts/pageParamsContext';
@@ -40,7 +35,6 @@ import {
4035
useSynchronizeCharts,
4136
} from 'sentry/views/insights/common/components/chart';
4237
import type {useSortedTimeSeries} from 'sentry/views/insights/common/queries/useSortedTimeSeries';
43-
import {useSpansQuery} from 'sentry/views/insights/common/queries/useSpansQuery';
4438

4539
interface ExploreChartsProps {
4640
canUsePreviousResults: boolean;
@@ -75,7 +69,6 @@ export function ExploreCharts({
7569
isProgressivelyLoading,
7670
}: ExploreChartsProps) {
7771
const theme = useTheme();
78-
const dataset = useExploreDataset();
7972
const visualizes = useExploreVisualizes();
8073
const setVisualizes = useSetExploreVisualizes();
8174
const [interval, setInterval, intervalOptions] = useChartInterval();
@@ -307,16 +300,14 @@ export function ExploreCharts({
307300
/>
308301
}
309302
Footer={
310-
dataset === DiscoverDatasets.SPANS_EAP_RPC && (
311-
<ConfidenceFooter
312-
sampleCount={chartInfo.sampleCount}
313-
isSampled={chartInfo.isSampled}
314-
confidence={chartInfo.confidence}
315-
topEvents={
316-
topEvents ? Math.min(topEvents, chartInfo.data.length) : undefined
317-
}
318-
/>
319-
)
303+
<ConfidenceFooter
304+
sampleCount={chartInfo.sampleCount}
305+
isSampled={chartInfo.isSampled}
306+
confidence={chartInfo.confidence}
307+
topEvents={
308+
topEvents ? Math.min(topEvents, chartInfo.data.length) : undefined
309+
}
310+
/>
320311
}
321312
/>
322313
);
@@ -326,48 +317,6 @@ export function ExploreCharts({
326317
);
327318
}
328319

329-
export function useExtrapolationMeta({
330-
dataset,
331-
query,
332-
isAllowedSelection,
333-
}: {
334-
dataset: DiscoverDatasets;
335-
query: string;
336-
isAllowedSelection?: boolean;
337-
}) {
338-
const {selection} = usePageFilters();
339-
340-
const extrapolationMetaEventView = useMemo(() => {
341-
const search = new MutableSearch(query);
342-
343-
// Filtering out all spans with op like 'ui.interaction*' which aren't
344-
// embedded under transactions. The trace view does not support rendering
345-
// such spans yet.
346-
search.addFilterValues('!transaction.span_id', ['00']);
347-
348-
const discoverQuery: NewQuery = {
349-
id: undefined,
350-
name: 'Explore - Extrapolation Meta',
351-
fields: ['count_sample()', 'min(sampling_rate)'],
352-
query: search.formatString(),
353-
version: 2,
354-
dataset,
355-
};
356-
357-
return EventView.fromNewQueryWithPageFilters(discoverQuery, selection);
358-
}, [dataset, query, selection]);
359-
360-
return useSpansQuery({
361-
eventView: extrapolationMetaEventView,
362-
initialData: [],
363-
referrer: 'api.explore.spans-extrapolation-meta',
364-
enabled:
365-
(defined(isAllowedSelection) ? isAllowedSelection : true) &&
366-
dataset === DiscoverDatasets.SPANS_EAP_RPC,
367-
trackResponseAnalytics: false,
368-
});
369-
}
370-
371320
const ChartList = styled('div')`
372321
display: grid;
373322
row-gap: ${space(1)};

static/app/views/explore/contexts/pageParamsContext/index.spec.tsx

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {DiscoverDatasets} from 'sentry/utils/discover/types';
44
import {
55
PageParamsProvider,
66
useExplorePageParams,
7-
useSetExploreDataset,
87
useSetExploreFields,
98
useSetExploreGroupBys,
109
useSetExploreId,
@@ -40,7 +39,6 @@ describe('defaults', function () {
4039
describe('PageParamsProvider', function () {
4140
let pageParams: ReturnType<typeof useExplorePageParams>;
4241
let setPageParams: ReturnType<typeof useSetExplorePageParams>;
43-
let setDataset: ReturnType<typeof useSetExploreDataset>;
4442
let setFields: ReturnType<typeof useSetExploreFields>;
4543
let setGroupBys: ReturnType<typeof useSetExploreGroupBys>;
4644
let setMode: ReturnType<typeof useSetExploreMode>;
@@ -53,7 +51,6 @@ describe('PageParamsProvider', function () {
5351
function Component() {
5452
pageParams = useExplorePageParams();
5553
setPageParams = useSetExplorePageParams();
56-
setDataset = useSetExploreDataset();
5754
setFields = useSetExploreFields();
5855
setGroupBys = useSetExploreGroupBys();
5956
setMode = useSetExploreMode();
@@ -125,28 +122,6 @@ describe('PageParamsProvider', function () {
125122
});
126123
});
127124

128-
it('correctly updates dataset', function () {
129-
renderTestComponent();
130-
131-
act(() => setDataset(DiscoverDatasets.SPANS_EAP));
132-
133-
expect(pageParams).toEqual({
134-
dataset: DiscoverDatasets.SPANS_EAP,
135-
fields: ['id', 'timestamp'],
136-
groupBys: ['span.op'],
137-
mode: Mode.AGGREGATE,
138-
query: '',
139-
sortBys: [{field: 'count(span.self_time)', kind: 'asc'}],
140-
visualizes: [
141-
{
142-
chartType: ChartType.AREA,
143-
label: 'A',
144-
yAxes: ['count(span.self_time)'],
145-
},
146-
],
147-
});
148-
});
149-
150125
it('correctly updates fields', function () {
151126
renderTestComponent();
152127

static/app/views/explore/contexts/pageParamsContext/index.tsx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type React from 'react';
22
import {createContext, useCallback, useContext, useMemo} from 'react';
33
import type {Location} from 'history';
44

5-
import {defined} from 'sentry/utils';
65
import type {Sort} from 'sentry/utils/discover/fields';
76
import {DiscoverDatasets} from 'sentry/utils/discover/types';
87
import {useLocation} from 'sentry/utils/useLocation';
@@ -144,12 +143,6 @@ export function useExplorePageParams(): ReadablePageParams {
144143
}
145144

146145
export function useExploreDataset(): DiscoverDatasets {
147-
const pageParams = useExplorePageParams();
148-
149-
if (defined(pageParams.dataset)) {
150-
return pageParams.dataset;
151-
}
152-
153146
return DiscoverDatasets.SPANS_EAP_RPC;
154147
}
155148

@@ -223,16 +216,6 @@ export function useSetExplorePageParams() {
223216
);
224217
}
225218

226-
export function useSetExploreDataset() {
227-
const setPageParams = useSetExplorePageParams();
228-
return useCallback(
229-
(dataset: DiscoverDatasets) => {
230-
setPageParams({dataset});
231-
},
232-
[setPageParams]
233-
);
234-
}
235-
236219
export function useSetExploreFields() {
237220
const setPageParams = useSetExplorePageParams();
238221
return useCallback(

static/app/views/explore/spans/spansTab.tsx

Lines changed: 25 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,14 @@ import {DatePageFilter} from 'sentry/components/organizations/datePageFilter';
1010
import {EnvironmentPageFilter} from 'sentry/components/organizations/environmentPageFilter';
1111
import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
1212
import {ProjectPageFilter} from 'sentry/components/organizations/projectPageFilter';
13-
import {
14-
EAPSpanSearchQueryBuilder,
15-
SpanSearchQueryBuilder,
16-
} from 'sentry/components/performance/spanSearchQueryBuilder';
13+
import {EAPSpanSearchQueryBuilder} from 'sentry/components/performance/spanSearchQueryBuilder';
1714
import {IconChevron} from 'sentry/icons/iconChevron';
1815
import {t} from 'sentry/locale';
1916
import {space} from 'sentry/styles/space';
2017
import type {PageFilters} from 'sentry/types/core';
2118
import type {Project} from 'sentry/types/project';
2219
import {defined} from 'sentry/utils';
2320
import {dedupeArray} from 'sentry/utils/dedupeArray';
24-
import {DiscoverDatasets} from 'sentry/utils/discover/types';
2521
import {
2622
type AggregationKey,
2723
ALLOWED_EXPLORE_VISUALIZE_AGGREGATES,
@@ -84,7 +80,6 @@ export function SpansTabContentImpl({
8480
}: SpanTabProps) {
8581
const organization = useOrganization();
8682
const {selection} = usePageFilters();
87-
const dataset = useExploreDataset();
8883
const mode = useExploreMode();
8984
const visualizes = useExploreVisualizes();
9085
const [samplesTab, setSamplesTab] = useTab();
@@ -106,9 +101,6 @@ export function SpansTabContentImpl({
106101
}, [id, visitQuery]);
107102

108103
const toolbarExtras = [
109-
...(organization?.features?.includes('visibility-explore-dataset')
110-
? ['dataset toggle' as const]
111-
: []),
112104
...(organization?.features?.includes('visibility-explore-equations')
113105
? ['equations' as const]
114106
: []),
@@ -222,40 +214,31 @@ export function SpansTabContentImpl({
222214
})}
223215
/>
224216
</StyledPageFilterBar>
225-
{dataset === DiscoverDatasets.SPANS_INDEXED ? (
226-
<SpanSearchQueryBuilder
227-
projects={selection.projects}
228-
initialQuery={query}
229-
onSearch={setQuery}
230-
searchSource="explore"
231-
/>
232-
) : (
233-
<EAPSpanSearchQueryBuilder
234-
projects={selection.projects}
235-
initialQuery={query}
236-
onSearch={setQuery}
237-
searchSource="explore"
238-
getFilterTokenWarning={
239-
mode === Mode.SAMPLES
240-
? key => {
241-
if (
242-
ALLOWED_EXPLORE_VISUALIZE_AGGREGATES.includes(key as AggregationKey)
243-
) {
244-
return t(
245-
"This key won't affect the results because samples mode does not support aggregate functions"
246-
);
247-
}
248-
return undefined;
217+
<EAPSpanSearchQueryBuilder
218+
projects={selection.projects}
219+
initialQuery={query}
220+
onSearch={setQuery}
221+
searchSource="explore"
222+
getFilterTokenWarning={
223+
mode === Mode.SAMPLES
224+
? key => {
225+
if (
226+
ALLOWED_EXPLORE_VISUALIZE_AGGREGATES.includes(key as AggregationKey)
227+
) {
228+
return t(
229+
"This key won't affect the results because samples mode does not support aggregate functions"
230+
);
249231
}
250-
: undefined
251-
}
252-
supportedAggregates={
253-
mode === Mode.SAMPLES ? [] : ALLOWED_EXPLORE_VISUALIZE_AGGREGATES
254-
}
255-
numberTags={numberTags}
256-
stringTags={stringTags}
257-
/>
258-
)}
232+
return undefined;
233+
}
234+
: undefined
235+
}
236+
supportedAggregates={
237+
mode === Mode.SAMPLES ? [] : ALLOWED_EXPLORE_VISUALIZE_AGGREGATES
238+
}
239+
numberTags={numberTags}
240+
stringTags={stringTags}
241+
/>
259242
</TopSection>
260243
<Feature features="organizations:traces-schema-hints">
261244
<SchemaHintsSection>

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

Lines changed: 2 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import ProjectsStore from 'sentry/stores/projectsStore';
1515
import {DiscoverDatasets} from 'sentry/utils/discover/types';
1616
import {
1717
PageParamsProvider,
18-
useExploreDataset,
1918
useExploreFields,
2019
useExploreGroupBys,
2120
useExploreMode,
@@ -54,67 +53,11 @@ describe('ExploreToolbar', function () {
5453
});
5554
});
5655

57-
it('should not render dataset selector', function () {
58-
function Component() {
59-
return <ExploreToolbar />;
60-
}
61-
render(
62-
<PageParamsProvider>
63-
<SpanTagsProvider dataset={DiscoverDatasets.SPANS_EAP} enabled>
64-
<Component />
65-
</SpanTagsProvider>
66-
</PageParamsProvider>,
67-
{enableRouterMocks: false}
68-
);
69-
const section = screen.queryByTestId('section-dataset');
70-
expect(section).not.toBeInTheDocument();
71-
});
72-
73-
it('allows changing datasets', async function () {
74-
let dataset: any;
75-
function Component() {
76-
dataset = useExploreDataset();
77-
return <ExploreToolbar extras={['dataset toggle']} />;
78-
}
79-
80-
render(
81-
<PageParamsProvider>
82-
<SpanTagsProvider dataset={DiscoverDatasets.SPANS_EAP} enabled>
83-
<Component />
84-
</SpanTagsProvider>
85-
</PageParamsProvider>,
86-
{enableRouterMocks: false}
87-
);
88-
89-
const section = screen.getByTestId('section-dataset');
90-
91-
const eapSpans = within(section).getByRole('radio', {name: 'EAP Spans'});
92-
const rpcSpans = within(section).getByRole('radio', {name: 'EAP RPC Spans'});
93-
const indexedSpans = within(section).getByRole('radio', {name: 'Indexed Spans'});
94-
95-
expect(eapSpans).not.toBeChecked();
96-
expect(rpcSpans).toBeChecked();
97-
expect(indexedSpans).not.toBeChecked();
98-
expect(dataset).toEqual(DiscoverDatasets.SPANS_EAP_RPC);
99-
100-
await userEvent.click(eapSpans);
101-
expect(eapSpans).toBeChecked();
102-
expect(rpcSpans).not.toBeChecked();
103-
expect(indexedSpans).not.toBeChecked();
104-
expect(dataset).toEqual(DiscoverDatasets.SPANS_EAP);
105-
106-
await userEvent.click(indexedSpans);
107-
expect(eapSpans).not.toBeChecked();
108-
expect(rpcSpans).not.toBeChecked();
109-
expect(indexedSpans).toBeChecked();
110-
expect(dataset).toEqual(DiscoverDatasets.SPANS_INDEXED);
111-
});
112-
11356
it('allows changing mode', async function () {
11457
let mode: any;
11558
function Component() {
11659
mode = useExploreMode();
117-
return <ExploreToolbar extras={['dataset toggle']} />;
60+
return <ExploreToolbar />;
11861
}
11962

12063
render(
@@ -151,7 +94,7 @@ describe('ExploreToolbar', function () {
15194
function Component() {
15295
fields = useExploreFields();
15396
groupBys = useExploreGroupBys();
154-
return <ExploreToolbar extras={['dataset toggle']} />;
97+
return <ExploreToolbar />;
15598
}
15699

157100
render(

0 commit comments

Comments
 (0)