|
@@ -1,14 +1,16 @@
|
|
|
-import React from 'react';
|
|
|
+import React, {useContext} from 'react';
|
|
|
import styled from '@emotion/styled';
|
|
|
|
|
|
import ErrorBoundary from 'sentry/components/errorBoundary';
|
|
|
import LoadingError from 'sentry/components/loadingError';
|
|
|
import LoadingIndicator from 'sentry/components/loadingIndicator';
|
|
|
+import QuickTrace from 'sentry/components/quickTrace';
|
|
|
+import {t} from 'sentry/locale';
|
|
|
import space from 'sentry/styles/space';
|
|
|
import {Event, EventTransaction, Organization} from 'sentry/types';
|
|
|
import EventView from 'sentry/utils/discover/eventView';
|
|
|
import GenericDiscoverQuery from 'sentry/utils/discover/genericDiscoverQuery';
|
|
|
-import QuickTraceQuery from 'sentry/utils/performance/quickTrace/quickTraceQuery';
|
|
|
+import {QuickTraceContext} from 'sentry/utils/performance/quickTrace/quickTraceContext';
|
|
|
import useApi from 'sentry/utils/useApi';
|
|
|
import {useLocation} from 'sentry/utils/useLocation';
|
|
|
|
|
@@ -28,6 +30,7 @@ export function EmbeddedSpanTree(props: Props) {
|
|
|
const {event, organization, projectSlug, focusedSpanIds} = props;
|
|
|
const api = useApi();
|
|
|
const location = useLocation();
|
|
|
+ const quickTrace = useContext(QuickTraceContext);
|
|
|
|
|
|
const eventView = EventView.fromNewQueryWithLocation(
|
|
|
{
|
|
@@ -42,62 +45,84 @@ export function EmbeddedSpanTree(props: Props) {
|
|
|
location
|
|
|
);
|
|
|
|
|
|
- return (
|
|
|
- <React.Fragment>
|
|
|
- <ErrorBoundary mini>
|
|
|
- <QuickTraceQuery event={event} location={location} orgSlug={organization.slug}>
|
|
|
- {results => {
|
|
|
- if (results.isLoading) {
|
|
|
- return <LoadingIndicator />;
|
|
|
- }
|
|
|
-
|
|
|
- if (!results.currentEvent) {
|
|
|
- return (
|
|
|
- <LoadingError message="Error loading the span tree because the root transaction is missing." />
|
|
|
- );
|
|
|
- }
|
|
|
+ function getContent() {
|
|
|
+ if (!quickTrace) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (quickTrace.isLoading) {
|
|
|
+ return <LoadingIndicator />;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!quickTrace.currentEvent) {
|
|
|
+ return (
|
|
|
+ <LoadingError
|
|
|
+ message={t(
|
|
|
+ 'Error loading the span tree because the root transaction is missing'
|
|
|
+ )}
|
|
|
+ />
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
+ return (
|
|
|
+ <GenericDiscoverQuery
|
|
|
+ eventView={eventView}
|
|
|
+ orgSlug={organization.slug}
|
|
|
+ route={`events/${projectSlug}:${quickTrace.currentEvent.event_id}`}
|
|
|
+ api={api}
|
|
|
+ location={location}
|
|
|
+ >
|
|
|
+ {_results => {
|
|
|
+ if (_results.isLoading) {
|
|
|
+ return <LoadingIndicator />;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!_results.tableData) {
|
|
|
return (
|
|
|
- <GenericDiscoverQuery
|
|
|
- eventView={eventView}
|
|
|
- orgSlug={organization.slug}
|
|
|
- route={`events/${projectSlug}:${results.currentEvent?.event_id}`}
|
|
|
- api={api}
|
|
|
- location={location}
|
|
|
- >
|
|
|
- {_results => {
|
|
|
- if (_results.isLoading) {
|
|
|
- return <LoadingIndicator />;
|
|
|
- }
|
|
|
+ <LoadingError
|
|
|
+ message={t(
|
|
|
+ 'Error loading the span tree because the root transaction is missing'
|
|
|
+ )}
|
|
|
+ />
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
- if (!_results.tableData) {
|
|
|
- return (
|
|
|
- <LoadingError message="Error loading the span tree because the root transaction is missing." />
|
|
|
- );
|
|
|
+ return (
|
|
|
+ <Wrapper>
|
|
|
+ <Header>
|
|
|
+ <h3>{t('Span Tree')}</h3>
|
|
|
+ <QuickTrace
|
|
|
+ event={event}
|
|
|
+ quickTrace={quickTrace!}
|
|
|
+ location={location}
|
|
|
+ organization={organization}
|
|
|
+ anchor="left"
|
|
|
+ errorDest="issue"
|
|
|
+ transactionDest="performance"
|
|
|
+ />
|
|
|
+ </Header>
|
|
|
+
|
|
|
+ <Section>
|
|
|
+ <TraceView
|
|
|
+ organization={organization}
|
|
|
+ waterfallModel={
|
|
|
+ new WaterfallModel(
|
|
|
+ _results.tableData as EventTransaction,
|
|
|
+ focusedSpanIds
|
|
|
+ )
|
|
|
}
|
|
|
+ />
|
|
|
+ </Section>
|
|
|
+ </Wrapper>
|
|
|
+ );
|
|
|
+ }}
|
|
|
+ </GenericDiscoverQuery>
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
- return (
|
|
|
- <Wrapper>
|
|
|
- <h3>Span Tree</h3>
|
|
|
- <Section>
|
|
|
- <TraceView
|
|
|
- organization={organization}
|
|
|
- waterfallModel={
|
|
|
- new WaterfallModel(
|
|
|
- _results.tableData as EventTransaction,
|
|
|
- focusedSpanIds
|
|
|
- )
|
|
|
- }
|
|
|
- />
|
|
|
- </Section>
|
|
|
- </Wrapper>
|
|
|
- );
|
|
|
- }}
|
|
|
- </GenericDiscoverQuery>
|
|
|
- );
|
|
|
- }}
|
|
|
- </QuickTraceQuery>
|
|
|
- </ErrorBoundary>
|
|
|
+ return (
|
|
|
+ <React.Fragment>
|
|
|
+ <ErrorBoundary mini>{getContent()}</ErrorBoundary>
|
|
|
</React.Fragment>
|
|
|
);
|
|
|
}
|
|
@@ -128,6 +153,11 @@ export const Wrapper = styled('div')`
|
|
|
}
|
|
|
`;
|
|
|
|
|
|
+const Header = styled('div')`
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+`;
|
|
|
+
|
|
|
const Section = styled('div')`
|
|
|
border: 1px solid ${p => p.theme.innerBorder};
|
|
|
border-radius: ${p => p.theme.borderRadius};
|