Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions static/app/components/events/metrics/metricsDrawer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import {useRef} from 'react';

import {ProjectAvatar} from 'sentry/components/core/avatar/projectAvatar';
import {
CrumbContainer,
EventDrawerBody,
EventDrawerContainer,
EventDrawerHeader,
EventNavigator,
NavigationCrumbs,
ShortId,
} from 'sentry/components/events/eventDrawer';
import {SearchQueryBuilder} from 'sentry/components/searchQueryBuilder';
import {t} from 'sentry/locale';
import type {Event} from 'sentry/types/event';
import type {Group} from 'sentry/types/group';
import type {Project} from 'sentry/types/project';
import {getShortEventId} from 'sentry/utils/events';
import {MetricsSamplesTable} from 'sentry/views/explore/metrics/metricInfoTabs/metricsSamplesTable';
import {
useQueryParamsSearch,
useSetQueryParamsQuery,
} from 'sentry/views/explore/queryParams/context';

interface MetricsIssueDrawerProps {
event: Event;
group: Group;
project: Project;
}

export function MetricsDrawer({event, project, group}: MetricsIssueDrawerProps) {
const setMetricsQuery = useSetQueryParamsQuery();
const metricsSearch = useQueryParamsSearch();
const containerRef = useRef<HTMLDivElement>(null);

return (
<EventDrawerContainer>
<EventDrawerHeader>
<NavigationCrumbs
crumbs={[
{
label: (
<CrumbContainer>
<ProjectAvatar project={project} />
<ShortId>{group.shortId}</ShortId>
</CrumbContainer>
),
},
{label: getShortEventId(event.id)},
{label: t('Metrics')},
]}
/>
</EventDrawerHeader>
<EventNavigator style={{gap: '0px'}}>
<SearchQueryBuilder
placeholder={t('Search metrics for this trace')}
filterKeys={{}}
getTagValues={() => new Promise<string[]>(() => [])}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Unresolved Promises Cause Indefinite Hangs

The getTagValues prop creates a Promise that never resolves. The executor function () => [] returns an array but doesn't call resolve or reject, causing the promise to hang indefinitely. This should be Promise.resolve([]) or new Promise((resolve) => resolve([])).

Fix in Cursor Fix in Web

initialQuery={metricsSearch.formatString()}
searchSource="tracemetrics"
onSearch={query => setMetricsQuery(query)}
/>
</EventNavigator>
<EventDrawerBody ref={containerRef}>
<div>
<MetricsSamplesTable embedded />
</div>
</EventDrawerBody>
</EventDrawerContainer>
);
}
Loading
Loading