|
@@ -3,11 +3,13 @@ import styled from '@emotion/styled';
|
|
|
import isFinite from 'lodash/isFinite';
|
|
|
|
|
|
import {SectionHeading} from 'app/components/charts/styles';
|
|
|
+import {ActiveOperationFilter} from 'app/components/events/interfaces/spans/filter';
|
|
|
import {
|
|
|
RawSpanType,
|
|
|
SpanEntry,
|
|
|
TraceContextType,
|
|
|
} from 'app/components/events/interfaces/spans/types';
|
|
|
+import {getSpanOperation} from 'app/components/events/interfaces/spans/utils';
|
|
|
import {pickBarColour} from 'app/components/performance/waterfall/utils';
|
|
|
import QuestionTooltip from 'app/components/questionTooltip';
|
|
|
import {t} from 'app/locale';
|
|
@@ -46,6 +48,7 @@ type DefaultProps = {
|
|
|
};
|
|
|
|
|
|
type Props = DefaultProps & {
|
|
|
+ operationNameFilters: ActiveOperationFilter;
|
|
|
event: Event;
|
|
|
};
|
|
|
|
|
@@ -66,7 +69,7 @@ class OpsBreakdown extends Component<Props> {
|
|
|
}
|
|
|
|
|
|
generateStats(): OpBreakdownType {
|
|
|
- const {topN} = this.props;
|
|
|
+ const {topN, operationNameFilters} = this.props;
|
|
|
const event = this.getTransactionEvent();
|
|
|
|
|
|
if (!event) {
|
|
@@ -85,20 +88,34 @@ class OpsBreakdown extends Component<Props> {
|
|
|
|
|
|
let spans: RawSpanType[] = spanEntry?.data ?? [];
|
|
|
|
|
|
+ const rootSpan = {
|
|
|
+ op: traceContext.op,
|
|
|
+ timestamp: event.endTimestamp,
|
|
|
+ start_timestamp: event.startTimestamp,
|
|
|
+ trace_id: traceContext.trace_id || '',
|
|
|
+ span_id: traceContext.span_id || '',
|
|
|
+ data: {},
|
|
|
+ };
|
|
|
+
|
|
|
spans =
|
|
|
spans.length > 0
|
|
|
? spans
|
|
|
: // if there are no descendent spans, then use the transaction root span
|
|
|
- [
|
|
|
- {
|
|
|
- op: traceContext.op,
|
|
|
- timestamp: event.endTimestamp,
|
|
|
- start_timestamp: event.startTimestamp,
|
|
|
- trace_id: traceContext.trace_id || '',
|
|
|
- span_id: traceContext.span_id || '',
|
|
|
- data: {},
|
|
|
- },
|
|
|
- ];
|
|
|
+ [rootSpan];
|
|
|
+
|
|
|
+ // Filter spans by operation name
|
|
|
+ if (operationNameFilters.type === 'active_filter') {
|
|
|
+ spans = [...spans, rootSpan];
|
|
|
+ spans = spans.filter(span => {
|
|
|
+ const operationName = getSpanOperation(span);
|
|
|
+
|
|
|
+ const shouldFilterOut =
|
|
|
+ typeof operationName === 'string' &&
|
|
|
+ !operationNameFilters.operationNames.has(operationName);
|
|
|
+
|
|
|
+ return !shouldFilterOut;
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
const operationNameIntervals = spans.reduce(
|
|
|
(intervals: Partial<OperationNameIntervals>, span: RawSpanType) => {
|