import {Fragment} from 'react'; import styled from '@emotion/styled'; import GuideAnchor from 'sentry/components/assistant/guideAnchor'; import Link from 'sentry/components/links/link'; import LoadingIndicator from 'sentry/components/loadingIndicator'; import {Tooltip} from 'sentry/components/tooltip'; import {IconPlay} from 'sentry/icons'; import {t, tn} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import type {EventTransaction, Organization} from 'sentry/types'; import {getShortEventId} from 'sentry/utils/events'; import {getDuration} from 'sentry/utils/formatters'; import type {TraceMetaQueryChildrenProps} from 'sentry/utils/performance/quickTrace/traceMetaQuery'; import type { TraceFullDetailed, TraceSplitResults, } from 'sentry/utils/performance/quickTrace/types'; import type {UseApiQueryResult} from 'sentry/utils/queryClient'; import type RequestError from 'sentry/utils/requestError/requestError'; import {normalizeUrl} from 'sentry/utils/withDomainRequired'; import {getTraceInfo} from '../traceDetails/utils'; import {BrowserDisplay} from '../transactionDetails/eventMetas'; import {MetaData} from '../transactionDetails/styles'; type TraceHeaderProps = { metaResults: TraceMetaQueryChildrenProps; organization: Organization; rootEventResults: UseApiQueryResult; traces: TraceSplitResults | null; }; export default function TraceHeader(props: TraceHeaderProps) { const {metaResults, rootEventResults, traces, organization} = props; const {meta, isLoading: metaLoading} = metaResults; const {data: rootEvent, isLoading: rootEventLoading} = rootEventResults; const emptyTrace = traces?.transactions && traces?.transactions.length === 0 && traces?.orphan_errors && traces.orphan_errors.length === 0; const showLoadingIndicator = rootEventLoading && !emptyTrace; const errors = meta?.errors || 0; const performanceIssues = meta?.performance_issues || 0; const replay_id = rootEvent?.contexts.replay?.replay_id ?? ''; const traceInfo = getTraceInfo(traces?.transactions, traces?.orphan_errors); const loadingIndicator = ; return ( ) : ( '\u2014' ) } subtext={null} /> {replay_id && ( {getShortEventId(replay_id)} } subtext={null} /> )} 0 ? (
{tn('%s error issue', '%s error issues', errors)}
{tn( '%s performance issue', '%s performance issues', performanceIssues )}
) : null } showUnderline position="bottom" > {metaLoading ? loadingIndicator : errors || performanceIssues ? errors + performanceIssues : 0} } subtext={null} />
); } const FlexBox = styled('div')` display: flex; align-items: center; `; const TraceHeaderContainer = styled(FlexBox)` justify-content: space-between; `; const TraceHeaderRow = styled(FlexBox)` gap: ${space(2)}; `; const ReplayLinkBody = styled(FlexBox)` gap: ${space(0.25)}; `;