throughputChart.tsx 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import {CHART_PALETTE} from 'sentry/constants/chartPalette';
  2. import {t} from 'sentry/locale';
  3. import {CHART_HEIGHT} from 'sentry/views/performance/database/settings';
  4. import {useQueuesTimeSeriesQuery} from 'sentry/views/performance/queues/queries/useQueuesTimeSeriesQuery';
  5. import Chart, {ChartType} from 'sentry/views/starfish/components/chart';
  6. import ChartPanel from 'sentry/views/starfish/components/chartPanel';
  7. interface Props {
  8. destination?: string;
  9. error?: Error | null;
  10. }
  11. export function ThroughputChart({error, destination}: Props) {
  12. const {data, isLoading} = useQueuesTimeSeriesQuery({destination});
  13. return (
  14. <ChartPanel title={t('Published vs Processed')}>
  15. <Chart
  16. height={CHART_HEIGHT}
  17. grid={{
  18. left: '0',
  19. right: '0',
  20. top: '8px',
  21. bottom: '0',
  22. }}
  23. data={
  24. [
  25. {
  26. seriesName: t('Published'),
  27. data: data['count_op(queue.publish)'].data,
  28. },
  29. {
  30. seriesName: t('Processed'),
  31. data: data['count_op(queue.process)'].data,
  32. },
  33. ] ?? []
  34. }
  35. loading={isLoading}
  36. error={error}
  37. chartColors={CHART_PALETTE[2].slice(1, 3)}
  38. type={ChartType.LINE}
  39. showLegend
  40. />
  41. </ChartPanel>
  42. );
  43. }