import type {Location} from 'history'; import Feature from 'sentry/components/acl/feature'; import FeatureDisabled from 'sentry/components/acl/featureDisabled'; import ErrorBoundary from 'sentry/components/errorBoundary'; import {Hovercard} from 'sentry/components/hovercard'; import ExternalLink from 'sentry/components/links/externalLink'; import Placeholder from 'sentry/components/placeholder'; import QuickTrace from 'sentry/components/quickTrace'; import {t} from 'sentry/locale'; import type {AvatarProject} from 'sentry/types'; import type {Event} from 'sentry/types/event'; import {getConfigurePerformanceDocsLink} from 'sentry/utils/docs'; import type { QuickTraceQueryChildrenProps, TraceMeta, } from 'sentry/utils/performance/quickTrace/types'; import useOrganization from 'sentry/utils/useOrganization'; import {MetaData} from './styles'; import {TraceLink} from './traceLink'; interface Props extends Pick, 'errorDest' | 'transactionDest'> { anchor: 'left' | 'right'; event: Event; location: Location; quickTrace: QuickTraceQueryChildrenProps | null; traceMeta: TraceMeta | null; project?: AvatarProject; } export default function QuickTraceMeta({ event, location, quickTrace, traceMeta, anchor, errorDest, transactionDest, project, }: Props) { const organization = useOrganization(); const features = ['performance-view']; const noFeatureMessage = t('Requires performance monitoring.'); const docsLink = getConfigurePerformanceDocsLink(project); const traceId = event.contexts?.trace?.trace_id ?? null; let body: React.ReactNode; let footer: React.ReactNode; if ( !traceId || !quickTrace || (quickTrace.trace === null && !quickTrace.orphanErrors) ) { // this platform doesn't support performance don't show anything here if (docsLink === null) { return null; } body = t('Missing Trace'); // need to configure tracing footer = {t('Read the docs')}; } else { if (quickTrace.isLoading) { body = ; } else if (quickTrace.error) { body = '\u2014'; } else { body = ( ); } footer = ( ); } return ( {({hasFeature}) => { // also need to enable the performance feature if (!hasFeature) { footer = ( } > {footer} ); } return ; }} ); } export function QuickTraceMetaBase({ body, footer, }: { body: React.ReactNode; footer: React.ReactNode; }) { return ( {body}} subtext={
{footer}
} /> ); }