Skip to content

Commit 50c20a5

Browse files
committed
👔 Only query the first two cross events
1 parent f743117 commit 50c20a5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

static/app/views/explore/hooks/useCrossEventQueries.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {useMemo} from 'react';
22

33
import {defined} from 'sentry/utils';
4+
import {MAX_CROSS_EVENT_QUERIES} from 'sentry/views/explore/constants';
45
import {useQueryParamsCrossEvents} from 'sentry/views/explore/queryParams/context';
56

67
export function useCrossEventQueries() {
@@ -11,11 +12,15 @@ export function useCrossEventQueries() {
1112
return undefined;
1213
}
1314

15+
// We only want to include the first MAX_CROSS_EVENT_QUERIES cross events in the
16+
// actual API request to avoid overwhelming the backend.
17+
const slicedCrossEvents = crossEvents.slice(0, MAX_CROSS_EVENT_QUERIES);
18+
1419
const logQuery: string[] = [];
1520
const metricQuery: string[] = [];
1621
const spanQuery: string[] = [];
1722

18-
for (const crossEvent of crossEvents) {
23+
for (const crossEvent of slicedCrossEvents) {
1924
switch (crossEvent.type) {
2025
case 'spans':
2126
spanQuery.push(crossEvent.query);

0 commit comments

Comments
 (0)