|
@@ -13,10 +13,16 @@ import {space} from 'sentry/styles/space';
|
|
|
import type {Sort} from 'sentry/utils/discover/fields';
|
|
|
import {RateUnits} from 'sentry/utils/discover/fields';
|
|
|
import {formatRate} from 'sentry/utils/formatters';
|
|
|
+import {decodeScalar} from 'sentry/utils/queryString';
|
|
|
import {useLocation} from 'sentry/utils/useLocation';
|
|
|
import useOrganization from 'sentry/utils/useOrganization';
|
|
|
import {normalizeUrl} from 'sentry/utils/withDomainRequired';
|
|
|
+import {DurationAggregateSelector} from 'sentry/views/performance/database/durationAggregateSelector';
|
|
|
import {ModulePageProviders} from 'sentry/views/performance/database/modulePageProviders';
|
|
|
+import {
|
|
|
+ AVAILABLE_DURATION_AGGREGATE_OPTIONS,
|
|
|
+ DEFAULT_DURATION_AGGREGATE,
|
|
|
+} from 'sentry/views/performance/database/settings';
|
|
|
import {AVG_COLOR, THROUGHPUT_COLOR} from 'sentry/views/starfish/colours';
|
|
|
import Chart, {useSynchronizeCharts} from 'sentry/views/starfish/components/chart';
|
|
|
import ChartPanel from 'sentry/views/starfish/components/chartPanel';
|
|
@@ -29,10 +35,7 @@ import {
|
|
|
import {useSpanMetricsSeries} from 'sentry/views/starfish/queries/useSpanMetricsSeries';
|
|
|
import {SpanFunction, SpanMetricsField} from 'sentry/views/starfish/types';
|
|
|
import {QueryParameterNames} from 'sentry/views/starfish/views/queryParameters';
|
|
|
-import {
|
|
|
- getDurationChartTitle,
|
|
|
- getThroughputChartTitle,
|
|
|
-} from 'sentry/views/starfish/views/spans/types';
|
|
|
+import {getThroughputChartTitle} from 'sentry/views/starfish/views/spans/types';
|
|
|
import {useModuleSort} from 'sentry/views/starfish/views/spans/useModuleSort';
|
|
|
import {Block, BlockContainer} from 'sentry/views/starfish/views/spanSummaryPage/block';
|
|
|
import {SampleList} from 'sentry/views/starfish/views/spanSummaryPage/sampleList';
|
|
@@ -45,6 +48,7 @@ type Query = {
|
|
|
transaction: string;
|
|
|
transactionMethod: string;
|
|
|
[QueryParameterNames.SPANS_SORT]: string;
|
|
|
+ aggregate?: string;
|
|
|
};
|
|
|
|
|
|
type Props = {
|
|
@@ -55,6 +59,22 @@ function SpanSummaryPage({params}: Props) {
|
|
|
const organization = useOrganization();
|
|
|
const location = useLocation<Query>();
|
|
|
|
|
|
+ const arePercentilesEnabled = organization.features?.includes(
|
|
|
+ 'performance-database-view-percentiles'
|
|
|
+ );
|
|
|
+
|
|
|
+ let durationAggregate = arePercentilesEnabled
|
|
|
+ ? decodeScalar(location.query.aggregate, DEFAULT_DURATION_AGGREGATE)
|
|
|
+ : DEFAULT_DURATION_AGGREGATE;
|
|
|
+
|
|
|
+ if (
|
|
|
+ !AVAILABLE_DURATION_AGGREGATE_OPTIONS.map(option => option.value).includes(
|
|
|
+ durationAggregate
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ durationAggregate = DEFAULT_DURATION_AGGREGATE;
|
|
|
+ }
|
|
|
+
|
|
|
const {groupId} = params;
|
|
|
const {transaction, transactionMethod, endpoint, endpointMethod} = location.query;
|
|
|
|
|
@@ -95,22 +115,21 @@ function SpanSummaryPage({params}: Props) {
|
|
|
[SpanMetricsField.SPAN_GROUP]: string;
|
|
|
};
|
|
|
|
|
|
- const {isLoading: areSpanMetricsSeriesLoading, data: spanMetricsSeriesData} =
|
|
|
- useSpanMetricsSeries(
|
|
|
- groupId,
|
|
|
- queryFilter,
|
|
|
- [`avg(${SpanMetricsField.SPAN_SELF_TIME})`, 'spm()', 'http_error_count()'],
|
|
|
- 'api.starfish.span-summary-page-metrics-chart'
|
|
|
- );
|
|
|
-
|
|
|
- useSynchronizeCharts([!areSpanMetricsSeriesLoading]);
|
|
|
-
|
|
|
- const spanMetricsThroughputSeries = {
|
|
|
- seriesName: span?.[SpanMetricsField.SPAN_OP]?.startsWith('db')
|
|
|
- ? 'Queries'
|
|
|
- : 'Requests',
|
|
|
- data: spanMetricsSeriesData?.['spm()'].data,
|
|
|
- };
|
|
|
+ const {isLoading: isThroughputDataLoading, data: throughputData} = useSpanMetricsSeries(
|
|
|
+ groupId,
|
|
|
+ queryFilter,
|
|
|
+ ['spm()'],
|
|
|
+ 'api.starfish.span-summary-page-metrics-chart'
|
|
|
+ );
|
|
|
+
|
|
|
+ const {isLoading: isDurationDataLoading, data: durationData} = useSpanMetricsSeries(
|
|
|
+ groupId,
|
|
|
+ queryFilter,
|
|
|
+ [`${durationAggregate}(${SpanMetricsField.SPAN_SELF_TIME})`],
|
|
|
+ 'api.starfish.span-summary-page-metrics-chart'
|
|
|
+ );
|
|
|
+
|
|
|
+ useSynchronizeCharts([!isThroughputDataLoading && !isDurationDataLoading]);
|
|
|
|
|
|
return (
|
|
|
<ModulePageProviders
|
|
@@ -175,8 +194,8 @@ function SpanSummaryPage({params}: Props) {
|
|
|
>
|
|
|
<Chart
|
|
|
height={CHART_HEIGHT}
|
|
|
- data={[spanMetricsThroughputSeries]}
|
|
|
- loading={areSpanMetricsSeriesLoading}
|
|
|
+ data={[throughputData['spm()']]}
|
|
|
+ loading={isThroughputDataLoading}
|
|
|
utc={false}
|
|
|
chartColors={[THROUGHPUT_COLOR]}
|
|
|
isLineChart
|
|
@@ -191,13 +210,23 @@ function SpanSummaryPage({params}: Props) {
|
|
|
</Block>
|
|
|
|
|
|
<Block>
|
|
|
- <ChartPanel title={getDurationChartTitle(span?.[SpanMetricsField.SPAN_OP])}>
|
|
|
+ <ChartPanel
|
|
|
+ title={
|
|
|
+ arePercentilesEnabled ? (
|
|
|
+ <DurationAggregateSelector aggregate={durationAggregate} />
|
|
|
+ ) : (
|
|
|
+ t('Average Duration')
|
|
|
+ )
|
|
|
+ }
|
|
|
+ >
|
|
|
<Chart
|
|
|
height={CHART_HEIGHT}
|
|
|
data={[
|
|
|
- spanMetricsSeriesData?.[`avg(${SpanMetricsField.SPAN_SELF_TIME})`],
|
|
|
+ durationData[
|
|
|
+ `${durationAggregate}(${SpanMetricsField.SPAN_SELF_TIME})`
|
|
|
+ ],
|
|
|
]}
|
|
|
- loading={areSpanMetricsSeriesLoading}
|
|
|
+ loading={isDurationDataLoading}
|
|
|
utc={false}
|
|
|
chartColors={[AVG_COLOR]}
|
|
|
isLineChart
|