123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394 |
- import {Fragment, lazy, useRef} from 'react';
- import styled from '@emotion/styled';
- import {CommitRow} from 'sentry/components/commitRow';
- import ErrorBoundary from 'sentry/components/errorBoundary';
- import {EventContexts} from 'sentry/components/events/contexts';
- import {EventDevice} from 'sentry/components/events/device';
- import {EventAttachments} from 'sentry/components/events/eventAttachments';
- import {EventDataSection} from 'sentry/components/events/eventDataSection';
- import {EventEntry} from 'sentry/components/events/eventEntry';
- import {EventEvidence} from 'sentry/components/events/eventEvidence';
- import {EventExtraData} from 'sentry/components/events/eventExtraData';
- import EventHydrationDiff from 'sentry/components/events/eventHydrationDiff';
- import EventReplay from 'sentry/components/events/eventReplay';
- import {EventSdk} from 'sentry/components/events/eventSdk';
- import AggregateSpanDiff from 'sentry/components/events/eventStatisticalDetector/aggregateSpanDiff';
- import EventBreakpointChart from 'sentry/components/events/eventStatisticalDetector/breakpointChart';
- import {EventAffectedTransactions} from 'sentry/components/events/eventStatisticalDetector/eventAffectedTransactions';
- import EventComparison from 'sentry/components/events/eventStatisticalDetector/eventComparison';
- import {EventDifferentialFlamegraph} from 'sentry/components/events/eventStatisticalDetector/eventDifferentialFlamegraph';
- import {EventFunctionComparisonList} from 'sentry/components/events/eventStatisticalDetector/eventFunctionComparisonList';
- import {EventRegressionSummary} from 'sentry/components/events/eventStatisticalDetector/eventRegressionSummary';
- import {EventFunctionBreakpointChart} from 'sentry/components/events/eventStatisticalDetector/functionBreakpointChart';
- import {TransactionsDeltaProvider} from 'sentry/components/events/eventStatisticalDetector/transactionsDeltaProvider';
- import {EventTagsAndScreenshot} from 'sentry/components/events/eventTagsAndScreenshot';
- import {EventViewHierarchy} from 'sentry/components/events/eventViewHierarchy';
- import {EventGroupingInfo} from 'sentry/components/events/groupingInfo';
- import HighlightsDataSection from 'sentry/components/events/highlights/highlightsDataSection';
- import {ActionableItems} from 'sentry/components/events/interfaces/crashContent/exception/actionableItems';
- import {actionableItemsEnabled} from 'sentry/components/events/interfaces/crashContent/exception/useActionableItems';
- import {CronTimelineSection} from 'sentry/components/events/interfaces/crons/cronTimelineSection';
- import {AnrRootCause} from 'sentry/components/events/interfaces/performance/anrRootCause';
- import {SpanEvidenceSection} from 'sentry/components/events/interfaces/performance/spanEvidence';
- import {EventPackageData} from 'sentry/components/events/packageData';
- import {EventRRWebIntegration} from 'sentry/components/events/rrwebIntegration';
- import {DataSection} from 'sentry/components/events/styles';
- import {SuspectCommits} from 'sentry/components/events/suspectCommits';
- import {EventUserFeedback} from 'sentry/components/events/userFeedback';
- import LazyLoad from 'sentry/components/lazyLoad';
- import {t} from 'sentry/locale';
- import {space} from 'sentry/styles/space';
- import {
- type EntryException,
- type Event,
- EventOrGroupType,
- type Group,
- IssueCategory,
- IssueType,
- type Project,
- } from 'sentry/types';
- import type {EventTransaction} from 'sentry/types/event';
- import {EntryType} from 'sentry/types/event';
- import {shouldShowCustomErrorResourceConfig} from 'sentry/utils/issueTypeConfig';
- import {QuickTraceContext} from 'sentry/utils/performance/quickTrace/quickTraceContext';
- import QuickTraceQuery from 'sentry/utils/performance/quickTrace/quickTraceQuery';
- import {getReplayIdFromEvent} from 'sentry/utils/replays/getReplayIdFromEvent';
- import {useLocation} from 'sentry/utils/useLocation';
- import useOrganization from 'sentry/utils/useOrganization';
- import {ResourcesAndPossibleSolutions} from 'sentry/views/issueDetails/resourcesAndPossibleSolutions';
- const LLMMonitoringSection = lazy(
- () => import('sentry/components/events/interfaces/llm-monitoring/llmMonitoringSection')
- );
- type GroupEventDetailsContentProps = {
- group: Group;
- project: Project;
- event?: Event;
- };
- type GroupEventEntryProps = {
- entryType: EntryType;
- event: Event;
- group: Group;
- project: Project;
- };
- function GroupEventEntry({event, entryType, group, project}: GroupEventEntryProps) {
- const organization = useOrganization();
- const matchingEntry = event.entries.find(entry => entry.type === entryType);
- if (!matchingEntry) {
- return null;
- }
- return (
- <EventEntry
- projectSlug={project.slug}
- group={group}
- entry={matchingEntry}
- {...{organization, event}}
- />
- );
- }
- function DefaultGroupEventDetailsContent({
- group,
- event,
- project,
- }: Required<GroupEventDetailsContentProps>) {
- const organization = useOrganization();
- const location = useLocation();
- const tagsRef = useRef<HTMLDivElement>(null);
- const projectSlug = project.slug;
- const hasReplay = Boolean(getReplayIdFromEvent(event));
- const mechanism = event.tags?.find(({key}) => key === 'mechanism')?.value;
- const isANR = mechanism === 'ANR' || mechanism === 'AppExitInfo';
- const hasAnrImprovementsFeature = organization.features.includes('anr-improvements');
- const showPossibleSolutionsHigher = shouldShowCustomErrorResourceConfig(group, project);
- const eventEntryProps = {group, event, project};
- const hasActionableItems = actionableItemsEnabled({
- eventId: event.id,
- organization,
- projectSlug,
- });
- return (
- <Fragment>
- {hasActionableItems && (
- <ActionableItems event={event} project={project} isShare={false} />
- )}
- <StyledDataSection>
- <SuspectCommits
- project={project}
- eventId={event.id}
- group={group}
- commitRow={CommitRow}
- />
- </StyledDataSection>
- {event.userReport && (
- <EventDataSection title={t('User Feedback')} type="user-feedback">
- <EventUserFeedback
- report={event.userReport}
- orgSlug={organization.slug}
- issueId={group.id}
- showEventLink={false}
- />
- </EventDataSection>
- )}
- {event.type === EventOrGroupType.ERROR &&
- organization.features.includes('insights-addon-modules') &&
- event?.entries
- ?.filter((x): x is EntryException => x.type === EntryType.EXCEPTION)
- .flatMap(x => x.data.values ?? [])
- .some(({value}) => {
- const lowerText = value?.toLowerCase();
- return (
- lowerText &&
- (lowerText.includes('api key') || lowerText.includes('429')) &&
- (lowerText.includes('openai') ||
- lowerText.includes('anthropic') ||
- lowerText.includes('cohere') ||
- lowerText.includes('langchain'))
- );
- }) ? (
- <LazyLoad
- LazyComponent={LLMMonitoringSection}
- event={event}
- organization={organization}
- />
- ) : null}
- {group.issueCategory === IssueCategory.CRON && (
- <CronTimelineSection
- event={event}
- organization={organization}
- project={project}
- />
- )}
- <HighlightsDataSection
- event={event}
- group={group}
- project={project}
- viewAllRef={tagsRef}
- />
- {showPossibleSolutionsHigher && (
- <ResourcesAndPossibleSolutionsIssueDetailsContent
- event={event}
- project={project}
- group={group}
- />
- )}
- <EventEvidence event={event} group={group} project={project} />
- <GroupEventEntry entryType={EntryType.MESSAGE} {...eventEntryProps} />
- <GroupEventEntry entryType={EntryType.EXCEPTION} {...eventEntryProps} />
- <GroupEventEntry entryType={EntryType.STACKTRACE} {...eventEntryProps} />
- <GroupEventEntry entryType={EntryType.THREADS} {...eventEntryProps} />
- {hasAnrImprovementsFeature && isANR && (
- <QuickTraceQuery
- event={event}
- location={location}
- orgSlug={organization.slug}
- type={'spans'}
- skipLight
- >
- {results => {
- return (
- <QuickTraceContext.Provider value={results}>
- <AnrRootCause event={event} organization={organization} />
- </QuickTraceContext.Provider>
- );
- }}
- </QuickTraceQuery>
- )}
- {group.issueCategory === IssueCategory.PERFORMANCE && (
- <SpanEvidenceSection
- event={event as EventTransaction}
- organization={organization}
- projectSlug={project.slug}
- />
- )}
- <EventHydrationDiff event={event} group={group} />
- <EventReplay event={event} group={group} projectSlug={project.slug} />
- <GroupEventEntry entryType={EntryType.HPKP} {...eventEntryProps} />
- <GroupEventEntry entryType={EntryType.CSP} {...eventEntryProps} />
- <GroupEventEntry entryType={EntryType.EXPECTCT} {...eventEntryProps} />
- <GroupEventEntry entryType={EntryType.EXPECTSTAPLE} {...eventEntryProps} />
- <GroupEventEntry entryType={EntryType.TEMPLATE} {...eventEntryProps} />
- <GroupEventEntry entryType={EntryType.BREADCRUMBS} {...eventEntryProps} />
- {!showPossibleSolutionsHigher && (
- <ResourcesAndPossibleSolutionsIssueDetailsContent
- event={event}
- project={project}
- group={group}
- />
- )}
- <GroupEventEntry entryType={EntryType.DEBUGMETA} {...eventEntryProps} />
- <GroupEventEntry entryType={EntryType.REQUEST} {...eventEntryProps} />
- <div ref={tagsRef}>
- <EventTagsAndScreenshot event={event} projectSlug={project.slug} />
- </div>
- <EventContexts group={group} event={event} />
- <EventExtraData event={event} />
- <EventPackageData event={event} />
- <EventDevice event={event} />
- <EventViewHierarchy event={event} project={project} />
- <EventAttachments event={event} projectSlug={project.slug} />
- <EventSdk sdk={event.sdk} meta={event._meta?.sdk} />
- {event.groupID && (
- <EventGroupingInfo
- projectSlug={project.slug}
- event={event}
- showGroupingConfig={
- organization.features.includes('set-grouping-config') &&
- 'groupingConfig' in event
- }
- group={group}
- />
- )}
- {!hasReplay && (
- <EventRRWebIntegration
- event={event}
- orgId={organization.slug}
- projectSlug={project.slug}
- />
- )}
- </Fragment>
- );
- }
- function ResourcesAndPossibleSolutionsIssueDetailsContent({
- event,
- project,
- group,
- }: Required<GroupEventDetailsContentProps>) {
- return (
- <ErrorBoundary mini>
- <ResourcesAndPossibleSolutions event={event} project={project} group={group} />
- </ErrorBoundary>
- );
- }
- function PerformanceDurationRegressionIssueDetailsContent({
- group,
- event,
- project,
- }: Required<GroupEventDetailsContentProps>) {
- return (
- <Fragment>
- <ErrorBoundary mini>
- <EventRegressionSummary event={event} group={group} />
- </ErrorBoundary>
- <ErrorBoundary mini>
- <EventBreakpointChart event={event} />
- </ErrorBoundary>
- <ErrorBoundary mini>
- <AggregateSpanDiff event={event} project={project} />
- </ErrorBoundary>
- <ErrorBoundary mini>
- <EventComparison event={event} project={project} />
- </ErrorBoundary>
- </Fragment>
- );
- }
- function ProfilingDurationRegressionIssueDetailsContent({
- group,
- event,
- project,
- }: Required<GroupEventDetailsContentProps>) {
- return (
- <TransactionsDeltaProvider event={event} project={project}>
- <Fragment>
- <ErrorBoundary mini>
- <EventRegressionSummary event={event} group={group} />
- </ErrorBoundary>
- <ErrorBoundary mini>
- <EventFunctionBreakpointChart event={event} />
- </ErrorBoundary>
- <ErrorBoundary mini>
- <EventAffectedTransactions event={event} group={group} project={project} />
- </ErrorBoundary>
- <ErrorBoundary mini>
- <DataSection>
- <b>{t('Largest Changes in Call Stack Frequency')}</b>
- <p>
- {t(`See which functions changed the most before and after the regression. The
- frame with the largest increase in call stack population likely
- contributed to the cause for the duration regression.`)}
- </p>
- <EventDifferentialFlamegraph event={event} />
- </DataSection>
- </ErrorBoundary>
- <ErrorBoundary mini>
- <EventFunctionComparisonList event={event} group={group} project={project} />
- </ErrorBoundary>
- </Fragment>
- </TransactionsDeltaProvider>
- );
- }
- function GroupEventDetailsContent({
- group,
- event,
- project,
- }: GroupEventDetailsContentProps) {
- if (!event) {
- return (
- <NotFoundMessage>
- <h3>{t('Latest event not available')}</h3>
- </NotFoundMessage>
- );
- }
- switch (group.issueType) {
- case IssueType.PERFORMANCE_DURATION_REGRESSION:
- case IssueType.PERFORMANCE_ENDPOINT_REGRESSION: {
- return (
- <PerformanceDurationRegressionIssueDetailsContent
- group={group}
- event={event}
- project={project}
- />
- );
- }
- case IssueType.PROFILE_FUNCTION_REGRESSION_EXPERIMENTAL:
- case IssueType.PROFILE_FUNCTION_REGRESSION: {
- return (
- <ProfilingDurationRegressionIssueDetailsContent
- group={group}
- event={event}
- project={project}
- />
- );
- }
- default: {
- return (
- <DefaultGroupEventDetailsContent group={group} event={event} project={project} />
- );
- }
- }
- }
- const NotFoundMessage = styled('div')`
- padding: ${space(2)} ${space(4)};
- `;
- const StyledDataSection = styled(DataSection)`
- padding: ${space(0.5)} ${space(2)};
- @media (min-width: ${p => p.theme.breakpoints.medium}) {
- padding: ${space(1)} ${space(4)};
- }
- &:empty {
- display: none;
- }
- `;
- export default GroupEventDetailsContent;
|