throughputChart.tsx 1.4 KB

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