|
@@ -46,7 +46,9 @@ import {
|
|
|
SpanOperationBreakdownFilter,
|
|
|
stringToFilter,
|
|
|
} from 'sentry/views/performance/transactionSummary/filter';
|
|
|
-import {PercentChangeCell} from 'sentry/views/starfish/views/webServiceView/endpointList';
|
|
|
+import {PercentChangeCell} from 'sentry/views/starfish/components/tableCells/percentChangeCell';
|
|
|
+import {TimeSpentCell} from 'sentry/views/starfish/components/tableCells/timeSpentCell';
|
|
|
+import {SpanMetricsFields} from 'sentry/views/starfish/types';
|
|
|
|
|
|
import {decodeScalar} from '../queryString';
|
|
|
|
|
@@ -103,6 +105,7 @@ type FieldFormatters = {
|
|
|
duration: FieldFormatter;
|
|
|
integer: FieldFormatter;
|
|
|
number: FieldFormatter;
|
|
|
+ percent_change: FieldFormatter;
|
|
|
percentage: FieldFormatter;
|
|
|
size: FieldFormatter;
|
|
|
string: FieldFormatter;
|
|
@@ -291,6 +294,22 @@ export const FIELD_FORMATTERS: FieldFormatters = {
|
|
|
return <ArrayValue value={value} />;
|
|
|
},
|
|
|
},
|
|
|
+ percent_change: {
|
|
|
+ isSortable: true,
|
|
|
+ renderFunc: (fieldName, data) => {
|
|
|
+ const deltaValue = data[fieldName];
|
|
|
+
|
|
|
+ const sign = deltaValue >= 0 ? '+' : '-';
|
|
|
+ const delta = formatPercentage(Math.abs(deltaValue), 2);
|
|
|
+ const trendDirection = deltaValue < 0 ? 'good' : deltaValue > 0 ? 'bad' : 'neutral';
|
|
|
+
|
|
|
+ return (
|
|
|
+ <PercentChangeCell
|
|
|
+ trendDirection={trendDirection}
|
|
|
+ >{`${sign}${delta}`}</PercentChangeCell>
|
|
|
+ );
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|
|
|
|
|
|
type SpecialFieldRenderFunc = (
|
|
@@ -674,9 +693,8 @@ type SpecialFunctionFieldRenderer = (
|
|
|
) => (data: EventData, baggage: RenderFunctionBaggage) => React.ReactNode;
|
|
|
|
|
|
type SpecialFunctions = {
|
|
|
- http_error_count_percent_change: SpecialFunctionFieldRenderer;
|
|
|
- percentile_percent_change: SpecialFunctionFieldRenderer;
|
|
|
sps_percent_change: SpecialFunctionFieldRenderer;
|
|
|
+ time_spent_percentage: SpecialFunctionFieldRenderer;
|
|
|
user_misery: SpecialFunctionFieldRenderer;
|
|
|
};
|
|
|
|
|
@@ -744,9 +762,6 @@ const SPECIAL_FUNCTIONS: SpecialFunctions = {
|
|
|
</BarContainer>
|
|
|
);
|
|
|
},
|
|
|
- // TODO: As soon as events endpoints `meta` give `*_percent_change` fields a
|
|
|
- // type of `percentage_change` (as opposed to `percentage`, as it currently
|
|
|
- // is) all this logic can move down into FIELD_RENDERERS and be consolidated
|
|
|
sps_percent_change: fieldName => data => {
|
|
|
const deltaValue = data[fieldName];
|
|
|
|
|
@@ -758,30 +773,12 @@ const SPECIAL_FUNCTIONS: SpecialFunctions = {
|
|
|
<PercentChangeCell trendDirection="neutral">{`${sign}${delta}`}</PercentChangeCell>
|
|
|
);
|
|
|
},
|
|
|
- percentile_percent_change: fieldName => data => {
|
|
|
- const deltaValue = data[fieldName];
|
|
|
-
|
|
|
- const sign = deltaValue >= 0 ? '+' : '-';
|
|
|
- const delta = formatPercentage(Math.abs(deltaValue), 2);
|
|
|
- const trendDirection = deltaValue < 0 ? 'good' : deltaValue > 0 ? 'bad' : 'neutral';
|
|
|
-
|
|
|
- return (
|
|
|
- <PercentChangeCell
|
|
|
- trendDirection={trendDirection}
|
|
|
- >{`${sign}${delta}`}</PercentChangeCell>
|
|
|
- );
|
|
|
- },
|
|
|
- http_error_count_percent_change: fieldName => data => {
|
|
|
- const deltaValue = data[fieldName];
|
|
|
-
|
|
|
- const sign = deltaValue >= 0 ? '+' : '-';
|
|
|
- const delta = formatPercentage(Math.abs(deltaValue), 2);
|
|
|
- const trendDirection = deltaValue < 0 ? 'good' : deltaValue > 0 ? 'bad' : 'neutral';
|
|
|
-
|
|
|
+ time_spent_percentage: fieldName => data => {
|
|
|
return (
|
|
|
- <PercentChangeCell
|
|
|
- trendDirection={trendDirection}
|
|
|
- >{`${sign}${delta}`}</PercentChangeCell>
|
|
|
+ <TimeSpentCell
|
|
|
+ timeSpentPercentage={data[fieldName]}
|
|
|
+ totalSpanTime={data[`sum(${SpanMetricsFields.SPAN_SELF_TIME})`]}
|
|
|
+ />
|
|
|
);
|
|
|
},
|
|
|
};
|