Skip to content
Draft
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
26 changes: 15 additions & 11 deletions static/app/views/performance/newTraceDetails/traceHeader/meta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ import type {OurLogsResponseItem} from 'sentry/views/explore/logs/types';
import type {TraceMetaQueryResults} from 'sentry/views/performance/newTraceDetails/traceApi/useTraceMeta';
import type {RepresentativeTraceEvent} from 'sentry/views/performance/newTraceDetails/traceApi/utils';
import {TraceDrawerComponents} from 'sentry/views/performance/newTraceDetails/traceDrawer/details/styles';
import {
isEAPError,
isTraceError,
} from 'sentry/views/performance/newTraceDetails/traceGuards';
import type {TraceTree} from 'sentry/views/performance/newTraceDetails/traceModels/traceTree';
import {useTraceQueryParams} from 'sentry/views/performance/newTraceDetails/useTraceQueryParams';

Expand Down Expand Up @@ -57,16 +53,24 @@ interface MetaProps {
}

function getRootDuration(event: TraceTree.TraceEvent | null) {
if (!event || isEAPError(event) || isTraceError(event)) {
if (!event) {
return '\u2014';
}

return getDuration(
('timestamp' in event ? event.timestamp : event.end_timestamp) -
event.start_timestamp,
2,
true
);
const startTimestamp = 'start_timestamp' in event ? event.start_timestamp : undefined;
// TODO Abdullah Khan: Clean this up once getRepresentativeTraceEvent is moved to the TraceTree class
const endTimestamp =
'timestamp' in event
? event.timestamp
: 'event_timestamp' in event && typeof event.event_timestamp === 'number'
? event.event_timestamp
: undefined;

if (!startTimestamp || !endTimestamp) {
return '\u2014';
}

return getDuration(endTimestamp - startTimestamp, 2, true);
}

export function Meta(props: MetaProps) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
cancelAnimationTimeout,
requestAnimationTimeout,
} from 'sentry/utils/profiling/hooks/useVirtualizedTree/virtualizedTreeUtils';
import {isEAPError} from 'sentry/views/performance/newTraceDetails/traceGuards';
import {TraceTree} from 'sentry/views/performance/newTraceDetails/traceModels/traceTree';
import type {BaseNode} from 'sentry/views/performance/newTraceDetails/traceModels/traceTreeNode/baseNode';
import {TraceRowWidthMeasurer} from 'sentry/views/performance/newTraceDetails/traceRenderers/traceRowWidthMeasurer';
Expand Down Expand Up @@ -1715,7 +1714,7 @@ function getIconTimestamps(
}

for (const err of node.errors) {
const timestamp = isEAPError(err) ? err.start_timestamp : err.timestamp;
const timestamp = 'start_timestamp' in err ? err.start_timestamp : err.timestamp;
if (typeof timestamp === 'number') {
min_icon_timestamp = Math.min(min_icon_timestamp, timestamp * 1e3 - icon_width);
max_icon_timestamp = Math.max(max_icon_timestamp, timestamp * 1e3 + icon_width);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {useMemo} from 'react';
import {t} from 'sentry/locale';
import {
isCollapsedNode,
isEAPError,
isTraceErrorNode,
} from 'sentry/views/performance/newTraceDetails/traceGuards';
import type {BaseNode} from 'sentry/views/performance/newTraceDetails/traceModels/traceTreeNode/baseNode';
Expand All @@ -25,7 +26,7 @@ export function TraceCollapsedRow(props: TraceRowProps<CollapsedNode>) {

seen.add(c);

if (isTraceErrorNode(c)) {
if (isTraceErrorNode(c) || isEAPError(c.value)) {
childStatistics.issues++;
} else {
childStatistics.events++;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {Fragment, useMemo} from 'react';
import clamp from 'lodash/clamp';

import {isEAPError} from 'sentry/views/performance/newTraceDetails/traceGuards';
import {TraceIcons} from 'sentry/views/performance/newTraceDetails/traceIcons';
import type {BaseNode} from 'sentry/views/performance/newTraceDetails/traceModels/traceTreeNode/baseNode';
import type {VirtualizedViewManager} from 'sentry/views/performance/newTraceDetails/traceRenderers/virtualizedViewManager';
Expand All @@ -24,7 +23,8 @@ export function TraceErrorIcons(props: ErrorIconsProps) {
return (
<Fragment>
{errors.map((error, i) => {
const timestamp = isEAPError(error) ? error.start_timestamp : error.timestamp;
const timestamp =
'start_timestamp' in error ? error.start_timestamp : error.timestamp;
// Clamp the error timestamp to the span's timestamp
const left = props.manager.computeRelativeLeftPositionFromOrigin(
clamp(
Expand Down
Loading