throughputChart.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import type {Series} from 'sentry/types/echarts';
  2. import {RateUnit} from 'sentry/utils/discover/fields';
  3. import {formatRate} from 'sentry/utils/formatters';
  4. import {ALERTS} from 'sentry/views/insights/cache/alerts';
  5. import {CHART_HEIGHT} from 'sentry/views/insights/cache/settings';
  6. import {THROUGHPUT_COLOR} from 'sentry/views/insights/colors';
  7. import Chart, {ChartType} from 'sentry/views/insights/common/components/chart';
  8. import ChartPanel from 'sentry/views/insights/common/components/chartPanel';
  9. import {getThroughputChartTitle} from 'sentry/views/insights/common/views/spans/types';
  10. interface Props {
  11. isLoading: boolean;
  12. series: Series;
  13. error?: Error | null;
  14. }
  15. export function ThroughputChart({series, isLoading, error}: Props) {
  16. return (
  17. <ChartPanel
  18. title={getThroughputChartTitle('cache.get_item')}
  19. alertConfigs={[ALERTS.spm]}
  20. >
  21. <Chart
  22. height={CHART_HEIGHT}
  23. grid={{
  24. left: '0',
  25. right: '0',
  26. top: '8px',
  27. bottom: '0',
  28. }}
  29. data={[series]}
  30. loading={isLoading}
  31. error={error}
  32. chartColors={[THROUGHPUT_COLOR]}
  33. type={ChartType.LINE}
  34. aggregateOutputFormat="rate"
  35. rateUnit={RateUnit.PER_MINUTE}
  36. tooltipFormatterOptions={{
  37. valueFormatter: value => formatRate(value, RateUnit.PER_MINUTE),
  38. }}
  39. />
  40. </ChartPanel>
  41. );
  42. }