useProcessQueuesTimeSeriesQuery.tsx 862 B

1234567891011121314151617181920212223242526272829303132
  1. import {MutableSearch} from 'sentry/utils/tokenizeSearch';
  2. import {useSpanMetricsSeries} from 'sentry/views/insights/common/queries/useDiscoverSeries';
  3. import type {Referrer} from 'sentry/views/insights/queues/referrers';
  4. import type {SpanMetricsProperty} from 'sentry/views/insights/types';
  5. type Props = {
  6. referrer: Referrer;
  7. destination?: string;
  8. enabled?: boolean;
  9. };
  10. const yAxis: SpanMetricsProperty[] = [
  11. 'avg(span.duration)',
  12. 'avg(messaging.message.receive.latency)',
  13. 'spm()',
  14. ];
  15. export function useProcessQueuesTimeSeriesQuery({enabled, destination, referrer}: Props) {
  16. const search = new MutableSearch('span.op:queue.process');
  17. if (destination) {
  18. search.addFilterValue('messaging.destination.name', destination, false);
  19. }
  20. return useSpanMetricsSeries(
  21. {
  22. yAxis,
  23. search,
  24. enabled,
  25. },
  26. referrer
  27. );
  28. }