useProcessQueuesTimeSeriesQuery.tsx 903 B

123456789101112131415161718192021222324252627282930313233
  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. transformAliasToInputFormat: true,
  26. },
  27. referrer
  28. );
  29. }