hitMissChart.tsx 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import type {Series} from 'sentry/types/echarts';
  2. import {formatPercentage} from 'sentry/utils/number/formatPercentage';
  3. import {ALERTS} from 'sentry/views/insights/cache/alerts';
  4. import {CHART_HEIGHT} from 'sentry/views/insights/cache/settings';
  5. import {AVG_COLOR} from 'sentry/views/insights/colors';
  6. import Chart, {ChartType} from 'sentry/views/insights/common/components/chart';
  7. import ChartPanel from 'sentry/views/insights/common/components/chartPanel';
  8. import {DataTitles} from 'sentry/views/insights/common/views/spans/types';
  9. type Props = {
  10. isLoading: boolean;
  11. series: Series;
  12. error?: Error | null;
  13. };
  14. export function CacheHitMissChart({series, isLoading, error}: Props) {
  15. return (
  16. <ChartPanel title={DataTitles[`cache_miss_rate()`]} alertConfigs={[ALERTS.missRate]}>
  17. <Chart
  18. height={CHART_HEIGHT}
  19. grid={{
  20. left: '4px',
  21. right: '0',
  22. top: '8px',
  23. bottom: '0',
  24. }}
  25. data={[series]}
  26. loading={isLoading}
  27. error={error}
  28. chartColors={[AVG_COLOR]}
  29. type={ChartType.LINE}
  30. aggregateOutputFormat="percentage"
  31. tooltipFormatterOptions={{
  32. valueFormatter: value => formatPercentage(value),
  33. }}
  34. />
  35. </ChartPanel>
  36. );
  37. }