import {useMemo} from 'react'; import styled from '@emotion/styled'; import Alert from 'sentry/components/alert'; import {EventContexts} from 'sentry/components/events/contexts'; import {EventAttachments} from 'sentry/components/events/eventAttachments'; import {EventEvidence} from 'sentry/components/events/eventEvidence'; import {EventViewHierarchy} from 'sentry/components/events/eventViewHierarchy'; import {EventRRWebIntegration} from 'sentry/components/events/rrwebIntegration'; import ProjectBadge from 'sentry/components/idBadge/projectBadge'; import type {LazyRenderProps} from 'sentry/components/lazyRender'; import ExternalLink from 'sentry/components/links/externalLink'; import LoadingError from 'sentry/components/loadingError'; import LoadingIndicator from 'sentry/components/loadingIndicator'; import {CustomMetricsEventData} from 'sentry/components/metrics/customMetricsEventData'; import {Tooltip} from 'sentry/components/tooltip'; import {t, tct} from 'sentry/locale'; import type {EventTransaction} from 'sentry/types/event'; import type {Organization} from 'sentry/types/organization'; import type {Project} from 'sentry/types/project'; import {MutableSearch} from 'sentry/utils/tokenizeSearch'; import {useLocation} from 'sentry/utils/useLocation'; import useProjects from 'sentry/utils/useProjects'; import {useSpanMetrics} from 'sentry/views/insights/common/queries/useDiscover'; import type {SpanMetricsQueryFilters} from 'sentry/views/insights/types'; import {Referrer} from 'sentry/views/performance/newTraceDetails/referrers'; import {useTransaction} from 'sentry/views/performance/newTraceDetails/traceApi/useTransaction'; import {CacheMetrics} from 'sentry/views/performance/newTraceDetails/traceDrawer/details/transaction/sections/cacheMetrics'; import type {TraceTreeNodeDetailsProps} from 'sentry/views/performance/newTraceDetails/traceDrawer/tabs/traceTreeNodeDetails'; import type { TraceTree, TraceTreeNode, } from 'sentry/views/performance/newTraceDetails/traceModels/traceTree'; import {getCustomInstrumentationLink} from '../../../traceConfigurations'; import {IssueList} from '../issues/issues'; import {TraceDrawerComponents} from '../styles'; import {AdditionalData} from './sections/additionalData'; import {BreadCrumbs} from './sections/breadCrumbs'; import {Entries} from './sections/entries'; import GeneralInfo from './sections/generalInfo'; import {Measurements} from './sections/measurements'; import ReplayPreview from './sections/replayPreview'; import {Request} from './sections/request'; import {Sdk} from './sections/sdk'; export const LAZY_RENDER_PROPS: Partial = { observerOptions: {rootMargin: '50px'}, }; type TransactionNodeDetailHeaderProps = { event: EventTransaction; node: TraceTreeNode; onTabScrollToNode: (node: TraceTreeNode) => void; organization: Organization; project: Project | undefined; }; function TransactionNodeDetailHeader({ node, organization, project, onTabScrollToNode, event, }: TransactionNodeDetailHeaderProps) { return (
{t('transaction')}
); } export function TransactionNodeDetails({ node, organization, onTabScrollToNode, onParentClick, replayRecord, }: TraceTreeNodeDetailsProps>) { const location = useLocation(); const {projects} = useProjects(); const issues = useMemo(() => { return [...node.errors, ...node.performance_issues]; }, [node.errors, node.performance_issues]); const { data: event, isError, isPending, } = useTransaction({ node, organization, }); const {data: cacheMetrics} = useSpanMetrics( { search: MutableSearch.fromQueryObject({ transaction: node.value.transaction, } satisfies SpanMetricsQueryFilters), fields: ['avg(cache.item_size)', 'cache_miss_rate()'], }, Referrer.TRACE_DRAWER_TRANSACTION_CACHE_METRICS ); if (isPending) { return ; } if (isError) { return ; } const project = projects.find(proj => proj.slug === event?.projectSlug); return ( {!node.canFetch ? ( {tct( 'This transaction does not have any child spans. You can add more child spans via [customInstrumentationLink:custom instrumentation].', { customInstrumentationLink: ( ), } )} ) : null} {cacheMetrics.length > 0 ? : null} {event.projectSlug ? ( ) : null} {project ? : null} {replayRecord ? null : } {event.projectSlug ? ( ) : null} {project ? : null} {event.projectSlug ? ( ) : null} ); } const StyledAlert = styled(Alert)` margin: 0; `;