-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathhttpResponseCodesChartWidget.tsx
41 lines (39 loc) · 1.64 KB
/
httpResponseCodesChartWidget.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import {MutableSearch} from 'sentry/utils/tokenizeSearch';
import {InsightsLineChartWidget} from 'sentry/views/insights/common/components/insightsLineChartWidget';
import {useHttpLandingChartFilter} from 'sentry/views/insights/common/components/widgets/hooks/useHttpLandingChartFilter';
import type {LoadableChartWidgetProps} from 'sentry/views/insights/common/components/widgets/types';
import {useSpanMetricsSeries} from 'sentry/views/insights/common/queries/useDiscoverSeries';
import {DataTitles} from 'sentry/views/insights/common/views/spans/types';
import {Referrer} from 'sentry/views/insights/http/referrers';
import {FIELD_ALIASES} from 'sentry/views/insights/http/settings';
export default function HttpResponseCodesChartWidget(props: LoadableChartWidgetProps) {
const chartFilters = useHttpLandingChartFilter();
const {
isPending: isResponseCodeDataLoading,
data: responseCodeData,
error: responseCodeError,
} = useSpanMetricsSeries(
{
search: MutableSearch.fromQueryObject(chartFilters),
yAxis: ['http_response_rate(3)', 'http_response_rate(4)', 'http_response_rate(5)'],
transformAliasToInputFormat: true,
},
Referrer.LANDING_RESPONSE_CODE_CHART,
props.pageFilters
);
return (
<InsightsLineChartWidget
{...props}
id="httpResponseCodesChartWidget"
title={DataTitles.unsuccessfulHTTPCodes}
series={[
responseCodeData[`http_response_rate(3)`],
responseCodeData[`http_response_rate(4)`],
responseCodeData[`http_response_rate(5)`],
]}
aliases={FIELD_ALIASES}
isLoading={isResponseCodeDataLoading}
error={responseCodeError}
/>
);
}