|
@@ -1,4 +1,7 @@
|
|
-import MiniBarChart from 'sentry/components/charts/miniBarChart';
|
|
|
|
|
|
+import type {LineSeriesOption, YAXisComponentOption} from 'echarts';
|
|
|
|
+
|
|
|
|
+import MiniBarChart, {getYAxisMaxFn} from 'sentry/components/charts/miniBarChart';
|
|
|
|
+import LineSeries from 'sentry/components/charts/series/lineSeries';
|
|
import EmptyMessage from 'sentry/components/emptyMessage';
|
|
import EmptyMessage from 'sentry/components/emptyMessage';
|
|
import {Panel, PanelBody} from 'sentry/components/panels';
|
|
import {Panel, PanelBody} from 'sentry/components/panels';
|
|
import {t} from 'sentry/locale';
|
|
import {t} from 'sentry/locale';
|
|
@@ -38,12 +41,15 @@ const MonitorStats = ({monitor}: Props) => {
|
|
let emptyStats = true;
|
|
let emptyStats = true;
|
|
const success = {
|
|
const success = {
|
|
seriesName: t('Successful'),
|
|
seriesName: t('Successful'),
|
|
|
|
+ yAxisIndex: 0,
|
|
data: [] as SeriesDataUnit[],
|
|
data: [] as SeriesDataUnit[],
|
|
};
|
|
};
|
|
const failed = {
|
|
const failed = {
|
|
seriesName: t('Failed'),
|
|
seriesName: t('Failed'),
|
|
|
|
+ yAxisIndex: 0,
|
|
data: [] as SeriesDataUnit[],
|
|
data: [] as SeriesDataUnit[],
|
|
};
|
|
};
|
|
|
|
+ const durationData = [] as [number, number][];
|
|
|
|
|
|
data.stats?.forEach(p => {
|
|
data.stats?.forEach(p => {
|
|
if (p.ok || p.error) {
|
|
if (p.ok || p.error) {
|
|
@@ -52,9 +58,28 @@ const MonitorStats = ({monitor}: Props) => {
|
|
const timestamp = p.ts * 1000;
|
|
const timestamp = p.ts * 1000;
|
|
success.data.push({name: timestamp, value: p.ok});
|
|
success.data.push({name: timestamp, value: p.ok});
|
|
failed.data.push({name: timestamp, value: p.error});
|
|
failed.data.push({name: timestamp, value: p.error});
|
|
|
|
+ durationData.push([timestamp, Math.trunc(p.duration)]);
|
|
});
|
|
});
|
|
const colors = [theme.green300, theme.red300];
|
|
const colors = [theme.green300, theme.red300];
|
|
|
|
|
|
|
|
+ const additionalSeries: LineSeriesOption[] = [
|
|
|
|
+ LineSeries({
|
|
|
|
+ name: t('Duration'),
|
|
|
|
+ data: durationData,
|
|
|
|
+ lineStyle: {color: theme.purple300, width: 2},
|
|
|
|
+ itemStyle: {color: theme.purple300},
|
|
|
|
+ yAxisIndex: 1,
|
|
|
|
+ }),
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ const height = 150;
|
|
|
|
+ const yAxisOptions: YAXisComponentOption = {
|
|
|
|
+ max: getYAxisMaxFn(height),
|
|
|
|
+ splitLine: {
|
|
|
|
+ show: false,
|
|
|
|
+ },
|
|
|
|
+ };
|
|
|
|
+
|
|
return renderComponent(
|
|
return renderComponent(
|
|
<Panel>
|
|
<Panel>
|
|
<PanelBody withPadding>
|
|
<PanelBody withPadding>
|
|
@@ -65,8 +90,19 @@ const MonitorStats = ({monitor}: Props) => {
|
|
labelYAxisExtents
|
|
labelYAxisExtents
|
|
stacked
|
|
stacked
|
|
colors={colors}
|
|
colors={colors}
|
|
- height={150}
|
|
|
|
|
|
+ height={height}
|
|
series={[success, failed]}
|
|
series={[success, failed]}
|
|
|
|
+ additionalSeries={additionalSeries}
|
|
|
|
+ yAxes={[
|
|
|
|
+ {...yAxisOptions, type: 'value'},
|
|
|
|
+ {
|
|
|
|
+ ...yAxisOptions,
|
|
|
|
+ type: 'value',
|
|
|
|
+ axisLabel: {
|
|
|
|
+ formatter: '{value} ms',
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ ]}
|
|
/>
|
|
/>
|
|
) : (
|
|
) : (
|
|
<EmptyMessage
|
|
<EmptyMessage
|