Skip to content

Commit 4298ab0

Browse files
authored
ref(insights): remove eap conditionals from mobile modules (#95441)
Remove eap conditionals from mobile modules and some misc places
1 parent 46eb085 commit 4298ab0

File tree

17 files changed

+36
-233
lines changed

17 files changed

+36
-233
lines changed

static/app/views/insights/common/queries/useReleases.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {useLocation} from 'sentry/utils/useLocation';
1515
import useOrganization from 'sentry/utils/useOrganization';
1616
import usePageFilters from 'sentry/utils/usePageFilters';
1717
import type {ReleasesSortByOption} from 'sentry/views/insights/common/components/releasesSort';
18-
import {useInsightsEap} from 'sentry/views/insights/common/utils/useEap';
1918

2019
export function useReleases(
2120
searchTerm: string | undefined,
@@ -27,8 +26,6 @@ export function useReleases(
2726
const {environments, projects} = selection;
2827
const api = useApi();
2928

30-
const useEap = useInsightsEap();
31-
3229
const activeSort = sortBy ?? ReleasesSortOption.DATE;
3330
const releaseResults = useApiQuery<Release[]>(
3431
[
@@ -59,7 +56,7 @@ export function useReleases(
5956
query: `transaction.op:[ui.load,navigation] ${escapeFilterValue(
6057
`release:[${releases.map(r => `"${r.version}"`).join()}]`
6158
)}`,
62-
dataset: useEap ? DiscoverDatasets.SPANS_EAP_RPC : DiscoverDatasets.METRICS,
59+
dataset: DiscoverDatasets.SPANS_EAP_RPC,
6360
version: 2,
6461
projects: selection.projects,
6562
};

static/app/views/insights/common/views/spanSummaryPage/sampleList/index.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {useCallback, useMemo, useState} from 'react';
22
import styled from '@emotion/styled';
33

44
import {EventDrawerHeader} from 'sentry/components/events/eventDrawer';
5-
import {SpanSearchQueryBuilder} from 'sentry/components/performance/spanSearchQueryBuilder';
5+
import {EapSpanSearchQueryBuilderWrapper} from 'sentry/components/performance/spanSearchQueryBuilder';
66
import {COL_WIDTH_UNDEFINED} from 'sentry/components/tables/gridEditable';
77
import {t} from 'sentry/locale';
88
import {space} from 'sentry/styles/space';
@@ -25,7 +25,6 @@ import type {
2525
NonDefaultSpanSampleFields,
2626
SpanSample,
2727
} from 'sentry/views/insights/common/queries/useSpanSamples';
28-
import {useInsightsEap} from 'sentry/views/insights/common/utils/useEap';
2928
import DurationChart from 'sentry/views/insights/common/views/spanSummaryPage/sampleList/durationChart';
3029
import SampleInfo from 'sentry/views/insights/common/views/spanSummaryPage/sampleList/sampleInfo';
3130
import SampleTable from 'sentry/views/insights/common/views/spanSummaryPage/sampleList/sampleTable/sampleTable';
@@ -50,7 +49,6 @@ type Props = {
5049
export function SampleList({groupId, moduleName, transactionRoute, referrer}: Props) {
5150
const organization = useOrganization();
5251
const {view} = useDomainViewFilters();
53-
const useEap = useInsightsEap();
5452

5553
const {
5654
transaction: transactionName,
@@ -184,13 +182,12 @@ export function SampleList({groupId, moduleName, transactionRoute, referrer}: Pr
184182
/>
185183

186184
<StyledSearchBar>
187-
<SpanSearchQueryBuilder
185+
<EapSpanSearchQueryBuilderWrapper
188186
projects={selection.projects}
189187
initialQuery={spanSearchQuery ?? ''}
190188
onSearch={handleSearch}
191189
placeholder={t('Search for span attributes')}
192190
searchSource={`${moduleName}-sample-panel`}
193-
useEap={useEap}
194191
/>
195192
</StyledSearchBar>
196193

static/app/views/insights/common/views/spanSummaryPage/sampleList/sampleTable/sampleTable.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import type {
2020
SpanSample,
2121
} from 'sentry/views/insights/common/queries/useSpanSamples';
2222
import {useSpanSamples} from 'sentry/views/insights/common/queries/useSpanSamples';
23-
import {useInsightsEap} from 'sentry/views/insights/common/utils/useEap';
2423
import type {
2524
ModuleName,
2625
SpanMetricsQueryFilters,
@@ -65,8 +64,6 @@ function SampleTable({
6564
additionalFilters,
6665
subregions,
6766
}: Props) {
68-
const useEap = useInsightsEap();
69-
7067
const filters: SpanMetricsQueryFilters = {
7168
'span.group': groupId,
7269
transaction: transactionName,
@@ -120,14 +117,12 @@ function SampleTable({
120117

121118
const spans = spanSamplesData?.data ?? [];
122119

123-
const transactionIdField = useEap ? 'transaction.span_id' : 'transaction.id';
120+
const transactionIdField = 'transaction.span_id';
124121
const transactionIds = spans.map(span => span[transactionIdField]);
125122

126123
const isTransactionsEnabled = Boolean(transactionIds.length);
127124

128-
const search = useEap
129-
? `${SpanIndexedField.TRANSACTION_SPAN_ID}:[${transactionIds.join(',')}] is_transaction:true`
130-
: `id:[${transactionIds.join(',')}]`;
125+
const search = `${SpanIndexedField.TRANSACTION_SPAN_ID}:[${transactionIds.join(',')}] is_transaction:true`;
131126

132127
const {
133128
data: transactions,

static/app/views/insights/common/views/spans/selectors/domainSelector.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import usePageFilters from 'sentry/utils/usePageFilters';
1313
import {useSpanMetrics} from 'sentry/views/insights/common/queries/useDiscover';
1414
import {buildEventViewQuery} from 'sentry/views/insights/common/utils/buildEventViewQuery';
1515
import {useCompactSelectOptionsCache} from 'sentry/views/insights/common/utils/useCompactSelectOptionsCache';
16-
import {useInsightsEap} from 'sentry/views/insights/common/utils/useEap';
1716
import {useWasSearchSpaceExhausted} from 'sentry/views/insights/common/utils/useWasSearchSpaceExhausted';
1817
import {QueryParameterNames} from 'sentry/views/insights/common/views/queryParameters';
1918
import {EmptyContainer} from 'sentry/views/insights/common/views/spans/selectors/emptyOption';
@@ -40,7 +39,6 @@ export function DomainSelector({
4039
const location = useLocation();
4140
const organization = useOrganization();
4241
const pageFilters = usePageFilters();
43-
const useEap = useInsightsEap();
4442

4543
const [searchQuery, setSearchQuery] = useState<string>(''); // Debounced copy of `searchInputValue` used for the Discover query
4644

@@ -107,7 +105,7 @@ export function DomainSelector({
107105
uniqueDomains.add(domains[0]);
108106
domainList.push({
109107
label: domains[0],
110-
value: useEap ? `*${domains[0]}*` : domains[0],
108+
value: `*${domains[0]}*`,
111109
});
112110
} else {
113111
domains?.forEach(domain => {
@@ -117,21 +115,19 @@ export function DomainSelector({
117115
uniqueDomains.add(domain);
118116
domainList.push({
119117
label: domain,
120-
value: useEap ? `*,${domain},*` : domain,
118+
value: `*,${domain},*`,
121119
});
122120
});
123121
}
124122
});
125123

126124
if (value) {
127125
let scrubbedValue = value;
128-
if (useEap) {
129-
if (scrubbedValue.startsWith('*') && scrubbedValue.endsWith('*')) {
130-
scrubbedValue = scrubbedValue.slice(1, -1);
131-
}
132-
if (scrubbedValue.startsWith(',') && scrubbedValue.endsWith(',')) {
133-
scrubbedValue = scrubbedValue.slice(1, -1);
134-
}
126+
if (scrubbedValue.startsWith('*') && scrubbedValue.endsWith('*')) {
127+
scrubbedValue = scrubbedValue.slice(1, -1);
128+
}
129+
if (scrubbedValue.startsWith(',') && scrubbedValue.endsWith(',')) {
130+
scrubbedValue = scrubbedValue.slice(1, -1);
135131
}
136132
domainList.push({
137133
label: scrubbedValue,

static/app/views/insights/http/components/httpSamplesPanel.spec.tsx

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ describe('HTTPSamplesPanel', () => {
111111
describe('Status panel', () => {
112112
let eventsStatsRequestMock: jest.Mock;
113113
let samplesRequestMock: jest.Mock;
114-
let spanFieldTagsMock: jest.Mock;
115114

116115
beforeEach(() => {
117116
jest.mocked(useLocation).mockReturnValue({
@@ -195,21 +194,6 @@ describe('HTTPSamplesPanel', () => {
195194
meta: {},
196195
},
197196
});
198-
199-
spanFieldTagsMock = MockApiClient.addMockResponse({
200-
url: `/organizations/${organization.slug}/spans/fields/`,
201-
method: 'GET',
202-
body: [
203-
{
204-
key: 'api_key',
205-
name: 'Api Key',
206-
},
207-
{
208-
key: 'bytes.size',
209-
name: 'Bytes.Size',
210-
},
211-
],
212-
});
213197
});
214198

215199
it('fetches panel data', async () => {
@@ -292,19 +276,6 @@ describe('HTTPSamplesPanel', () => {
292276
})
293277
);
294278

295-
expect(spanFieldTagsMock).toHaveBeenNthCalledWith(
296-
1,
297-
`/organizations/${organization.slug}/spans/fields/`,
298-
expect.objectContaining({
299-
method: 'GET',
300-
query: {
301-
project: [],
302-
environment: [],
303-
statsPeriod: '1h',
304-
},
305-
})
306-
);
307-
308279
await waitForElementToBeRemoved(() => screen.queryAllByTestId('loading-indicator'));
309280
});
310281

@@ -338,7 +309,6 @@ describe('HTTPSamplesPanel', () => {
338309
describe('Duration panel', () => {
339310
let chartRequestMock: jest.Mock;
340311
let samplesRequestMock: jest.Mock;
341-
let spanFieldTagsMock: jest.Mock;
342312

343313
beforeEach(() => {
344314
jest.mocked(useLocation).mockReturnValue({
@@ -391,21 +361,6 @@ describe('HTTPSamplesPanel', () => {
391361
},
392362
},
393363
});
394-
395-
spanFieldTagsMock = MockApiClient.addMockResponse({
396-
url: `/organizations/${organization.slug}/spans/fields/`,
397-
method: 'GET',
398-
body: [
399-
{
400-
key: 'api_key',
401-
name: 'Api Key',
402-
},
403-
{
404-
key: 'bytes.size',
405-
name: 'Bytes.Size',
406-
},
407-
],
408-
});
409364
});
410365

411366
it('fetches panel data', async () => {
@@ -458,19 +413,6 @@ describe('HTTPSamplesPanel', () => {
458413
}),
459414
})
460415
);
461-
462-
expect(spanFieldTagsMock).toHaveBeenNthCalledWith(
463-
1,
464-
`/organizations/${organization.slug}/spans/fields/`,
465-
expect.objectContaining({
466-
method: 'GET',
467-
query: {
468-
project: [],
469-
environment: [],
470-
statsPeriod: '1h',
471-
},
472-
})
473-
);
474416
});
475417

476418
it('show basic transaction info', async () => {

static/app/views/insights/http/components/httpSamplesPanel.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {Button} from 'sentry/components/core/button';
66
import {CompactSelect} from 'sentry/components/core/compactSelect';
77
import {SegmentedControl} from 'sentry/components/core/segmentedControl';
88
import {EventDrawerHeader} from 'sentry/components/events/eventDrawer';
9-
import {SpanSearchQueryBuilder} from 'sentry/components/performance/spanSearchQueryBuilder';
9+
import {EapSpanSearchQueryBuilderWrapper} from 'sentry/components/performance/spanSearchQueryBuilder';
1010
import {t} from 'sentry/locale';
1111
import {space} from 'sentry/styles/space';
1212
import {trackAnalytics} from 'sentry/utils/analytics';
@@ -41,7 +41,6 @@ import {
4141
} from 'sentry/views/insights/common/queries/useDiscover';
4242
import {useSpanMetricsSeries} from 'sentry/views/insights/common/queries/useDiscoverSeries';
4343
import {useTopNSpanMetricsSeries} from 'sentry/views/insights/common/queries/useTopNDiscoverSeries';
44-
import {useInsightsEap} from 'sentry/views/insights/common/utils/useEap';
4544
import {
4645
DataTitles,
4746
getDurationChartTitle,
@@ -69,7 +68,6 @@ import {TraceViewSources} from 'sentry/views/performance/newTraceDetails/traceHe
6968
export function HTTPSamplesPanel() {
7069
const navigate = useNavigate();
7170
const location = useLocation();
72-
const useEap = useInsightsEap();
7371

7472
const query = useLocationQuery({
7573
fields: {
@@ -449,13 +447,12 @@ export function HTTPSamplesPanel() {
449447
)}
450448

451449
<ModuleLayout.Full>
452-
<SpanSearchQueryBuilder
450+
<EapSpanSearchQueryBuilderWrapper
453451
projects={selection.projects}
454452
initialQuery={query.spanSearchQuery}
455453
onSearch={handleSearch}
456454
placeholder={t('Search for span attributes')}
457455
searchSource={`${ModuleName.HTTP}-sample-panel`}
458-
useEap={useEap}
459456
/>
460457
</ModuleLayout.Full>
461458

static/app/views/insights/http/queries/useSpanSamples.spec.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ describe('useSpanSamples', () => {
133133
query: {
134134
additionalFields: ['transaction.span_id'],
135135
project: [],
136+
dataset: 'spans',
137+
sampling: 'NORMAL',
136138
query: `span.group:221aa7ebd216 release:0.0.1`,
137139
referrer: 'api-spec',
138140
statsPeriod: '10d',

static/app/views/insights/http/queries/useSpanSamples.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import type {
1313
NonDefaultSpanSampleFields,
1414
} from 'sentry/views/insights/common/queries/useSpanSamples';
1515
import {getDateConditions} from 'sentry/views/insights/common/utils/getDateConditions';
16-
import {useInsightsEap} from 'sentry/views/insights/common/utils/useEap';
1716
import {SpanIndexedField, type SpanIndexedResponse} from 'sentry/views/insights/types';
1817

1918
interface UseSpanSamplesOptions<Fields> {
@@ -37,7 +36,6 @@ export const useSpanSamples = <Fields extends NonDefaultSpanSampleFields[]>(
3736
max = undefined,
3837
} = options;
3938

40-
const useEap = useInsightsEap();
4139
const {selection} = usePageFilters();
4240
const organization = useOrganization();
4341

@@ -71,8 +69,8 @@ export const useSpanSamples = <Fields extends NonDefaultSpanSampleFields[]>(
7169
// TODO: transaction.span_id should be a default from the backend
7270
additionalFields: [...fields, SpanIndexedField.TRANSACTION_SPAN_ID],
7371
sort: '-timestamp',
74-
sampling: useEap ? SAMPLING_MODE.NORMAL : undefined,
75-
dataset: useEap ? DiscoverDatasets.SPANS_EAP : undefined,
72+
sampling: SAMPLING_MODE.NORMAL,
73+
dataset: DiscoverDatasets.SPANS_EAP,
7674
referrer,
7775
},
7876
},

static/app/views/insights/mobile/appStarts/components/charts/deviceClassBreakdownBarChart.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import {
3131
import {useMetrics} from 'sentry/views/insights/common/queries/useDiscover';
3232
import {useReleaseSelection} from 'sentry/views/insights/common/queries/useReleases';
3333
import {appendReleaseFilters} from 'sentry/views/insights/common/utils/releaseComparison';
34-
import {useInsightsEap} from 'sentry/views/insights/common/utils/useEap';
3534
import {COLD_START_TYPE} from 'sentry/views/insights/mobile/appStarts/components/startTypeSelector';
3635
import {Referrer} from 'sentry/views/insights/mobile/appStarts/referrers';
3736
import useCrossPlatformProject from 'sentry/views/insights/mobile/common/queries/useCrossPlatformProject';
@@ -54,7 +53,6 @@ function DeviceClassBreakdownBarChart({
5453
}: DeviceClassBreakdownBarChartProps) {
5554
const theme = useTheme();
5655
const location = useLocation();
57-
const useEap = useInsightsEap();
5856
const {query: locationQuery} = location;
5957
const {
6058
primaryRelease,
@@ -77,9 +75,7 @@ function DeviceClassBreakdownBarChart({
7775
if (searchQuery) {
7876
query.addStringFilter(prepareQueryForLandingPage(searchQuery, false));
7977
}
80-
if (useEap) {
81-
query.addFilterValue('is_transaction', 'true');
82-
}
78+
query.addFilterValue('is_transaction', 'true');
8379

8480
const search = new MutableSearch(
8581
appendReleaseFilters(query, primaryRelease, secondaryRelease)

static/app/views/insights/mobile/appStarts/views/screenSummaryPage.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import * as Layout from 'sentry/components/layouts/thirds';
77
import {t} from 'sentry/locale';
88
import {space} from 'sentry/styles/space';
99
import {DurationUnit} from 'sentry/utils/discover/fields';
10-
import {DiscoverDatasets} from 'sentry/utils/discover/types';
1110
import {PageAlert, PageAlertProvider} from 'sentry/utils/performance/contexts/pageAlert';
1211
import {useLocation} from 'sentry/utils/useLocation';
1312
import {useNavigate} from 'sentry/utils/useNavigate';
@@ -135,7 +134,6 @@ export function ScreenSummaryContentPage() {
135134
<StartTypeSelector />
136135
</ToolRibbon>
137136
<MobileMetricsRibbon
138-
dataset={DiscoverDatasets.SPANS_METRICS}
139137
filters={[
140138
`transaction:${transactionName}`,
141139
`span.op:app.start.${appStartType}`,

0 commit comments

Comments
 (0)