|
@@ -1,10 +1,13 @@
|
|
|
import styled from '@emotion/styled';
|
|
|
+import type {Location} from 'history';
|
|
|
|
|
|
import Link from 'sentry/components/links/link';
|
|
|
import {t} from 'sentry/locale';
|
|
|
import {space} from 'sentry/styles/space';
|
|
|
import type {Organization, Project} from 'sentry/types';
|
|
|
import type {AggregateEventTransaction} from 'sentry/types/event';
|
|
|
+import EventView from 'sentry/utils/discover/eventView';
|
|
|
+import {generateLinkToEventInTraceView} from 'sentry/utils/discover/urls';
|
|
|
import {formatPercentage, getDuration} from 'sentry/utils/formatters';
|
|
|
import type {
|
|
|
QuickTraceEvent,
|
|
@@ -27,20 +30,32 @@ type Props = {
|
|
|
trace: Readonly<ParsedTraceType>;
|
|
|
};
|
|
|
|
|
|
-function renderSpanSamples(span: AggregateSpanType, project: Project | undefined) {
|
|
|
+function renderSpanSamples(
|
|
|
+ aggSpan: AggregateSpanType,
|
|
|
+ project: Project | undefined,
|
|
|
+ location: Location,
|
|
|
+ organization: Organization
|
|
|
+) {
|
|
|
if (!project) {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- return span.samples?.map(([transactionId, spanId], index) => (
|
|
|
+ return aggSpan.samples?.map(({transaction, span, trace, timestamp}, index) => (
|
|
|
<Link
|
|
|
- key={`${transactionId}-${spanId}`}
|
|
|
- to={`/performance/${project.slug}:${transactionId}#span-${spanId}`}
|
|
|
- >{`${spanId}${index < span.samples.length - 1 ? ', ' : ''}`}</Link>
|
|
|
+ key={`${transaction}-${span}`}
|
|
|
+ to={generateLinkToEventInTraceView({
|
|
|
+ organization,
|
|
|
+ eventSlug: `${project.slug}:${transaction}`,
|
|
|
+ dataRow: {id: transaction, trace, timestamp},
|
|
|
+ location,
|
|
|
+ eventView: EventView.fromLocation(location),
|
|
|
+ spanId: span,
|
|
|
+ })}
|
|
|
+ >{`${span}${index < aggSpan.samples.length - 1 ? ', ' : ''}`}</Link>
|
|
|
));
|
|
|
}
|
|
|
|
|
|
-function AggregateSpanDetail({span}: Props) {
|
|
|
+function AggregateSpanDetail({span, organization}: Props) {
|
|
|
const location = useLocation();
|
|
|
const {projects} = useProjects();
|
|
|
|
|
@@ -62,7 +77,9 @@ function AggregateSpanDetail({span}: Props) {
|
|
|
<tbody>
|
|
|
<Row title={t('Avg Duration')}>{getDuration(avgDuration)}</Row>
|
|
|
<Row title={t('Frequency')}>{frequency && formatPercentage(frequency)}</Row>
|
|
|
- <Row title={t('Span Samples')}>{renderSpanSamples(span, project)}</Row>
|
|
|
+ <Row title={t('Span Samples')}>
|
|
|
+ {renderSpanSamples(span, project, location, organization)}
|
|
|
+ </Row>
|
|
|
</tbody>
|
|
|
</table>
|
|
|
</SpanDetails>
|