Skip to content

Commit 743539a

Browse files
authored
ref(insights): remove eap conditional asset module (#95154)
Now that eap is 100% ga for a few weeks, we can start removing the eap conditionals.
1 parent ce11d68 commit 743539a

File tree

2 files changed

+38
-77
lines changed

2 files changed

+38
-77
lines changed

static/app/views/insights/browser/resources/components/sampleImages.tsx

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,24 @@ import useOrganization from 'sentry/utils/useOrganization';
1616
import usePageFilters from 'sentry/utils/usePageFilters';
1717
import useProjects from 'sentry/utils/useProjects';
1818
import ResourceSize from 'sentry/views/insights/browser/resources/components/resourceSize';
19-
import {useIndexedResourcesQuery} from 'sentry/views/insights/browser/resources/queries/useIndexedResourceQuery';
2019
import {useResourceModuleFilters} from 'sentry/views/insights/browser/resources/utils/useResourceFilters';
2120
import ChartPanel from 'sentry/views/insights/common/components/chartPanel';
22-
import {SpanIndexedField} from 'sentry/views/insights/types';
21+
import {useEAPSpans} from 'sentry/views/insights/common/queries/useDiscover';
22+
import type {EAPSpanResponse} from 'sentry/views/insights/types';
23+
import {SpanFields} from 'sentry/views/insights/types';
2324
import {usePerformanceGeneralProjectSettings} from 'sentry/views/performance/utils';
2425

2526
type Props = {groupId: string; projectId?: number};
2627

2728
export const LOCAL_STORAGE_SHOW_LINKS = 'performance-resources-images-showLinks';
2829

29-
const {SPAN_GROUP, RAW_DOMAIN, SPAN_DESCRIPTION, HTTP_RESPONSE_CONTENT_LENGTH, SPAN_OP} =
30-
SpanIndexedField;
30+
const {
31+
SPAN_GROUP,
32+
RAW_DOMAIN,
33+
SPAN_DESCRIPTION,
34+
MEASUREMENT_HTTP_RESPONSE_CONTENT_LENGTH,
35+
SPAN_OP,
36+
} = SpanFields;
3137
const imageWidth = '200px';
3238
const imageHeight = '180px';
3339

@@ -39,15 +45,24 @@ function SampleImages({groupId, projectId}: Props) {
3945
usePerformanceGeneralProjectSettings(projectId);
4046
const isImagesEnabled = settings?.enable_images ?? false;
4147

42-
const {data: imageResources, isPending: isLoadingImages} = useIndexedResourcesQuery({
43-
queryConditions: [
44-
`${SPAN_GROUP}:${groupId}`,
45-
...(filters[SPAN_OP] ? [`${SPAN_OP}:${filters[SPAN_OP]}`] : []),
46-
],
47-
sorts: [{field: `measurements.${HTTP_RESPONSE_CONTENT_LENGTH}`, kind: 'desc'}],
48-
limit: 100,
49-
referrer: 'api.performance.resources.sample-images',
50-
});
48+
const {data: imageResources, isPending: isLoadingImages} = useEAPSpans(
49+
{
50+
fields: [
51+
SpanFields.PROJECT,
52+
SpanFields.SPAN_GROUP,
53+
SpanFields.RAW_DOMAIN,
54+
SpanFields.SPAN_DESCRIPTION,
55+
SpanFields.MEASUREMENT_HTTP_RESPONSE_CONTENT_LENGTH,
56+
],
57+
limit: 100,
58+
sorts: [{field: MEASUREMENT_HTTP_RESPONSE_CONTENT_LENGTH, kind: 'desc'}],
59+
search: [
60+
`${SPAN_GROUP}:${groupId}`,
61+
...(filters[SPAN_OP] ? [`${SPAN_OP}:${filters[SPAN_OP]}`] : []),
62+
].join(' '),
63+
},
64+
'api.performance.resources.sample-images'
65+
);
5166

5267
const uniqueResources = new Set();
5368

@@ -81,8 +96,16 @@ function SampleImages({groupId, projectId}: Props) {
8196
);
8297
}
8398

99+
type ImageSpan = Pick<
100+
EAPSpanResponse,
101+
| 'span.group'
102+
| 'raw_domain'
103+
| 'span.description'
104+
| 'measurements.http.response_content_length'
105+
>;
106+
84107
function SampleImagesChartPanelBody(props: {
85-
images: ReturnType<typeof useIndexedResourcesQuery>['data'];
108+
images: ImageSpan[];
86109
isImagesEnabled: boolean;
87110
isLoadingImages: boolean;
88111
isSettingsLoading: boolean;
@@ -147,7 +170,7 @@ function SampleImagesChartPanelBody(props: {
147170
src={src}
148171
showImage={isImagesEnabled}
149172
fileName={getFileNameFromDescription(resource[SPAN_DESCRIPTION])}
150-
size={resource[`measurements.${HTTP_RESPONSE_CONTENT_LENGTH}`]}
173+
size={resource[MEASUREMENT_HTTP_RESPONSE_CONTENT_LENGTH]}
151174
key={resource[SPAN_DESCRIPTION]}
152175
/>
153176
);

static/app/views/insights/browser/resources/queries/useIndexedResourceQuery.ts

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)