useQueuesTimeSeriesQuery.tsx 877 B

12345678910111213141516171819202122232425262728
  1. import {MutableSearch} from 'sentry/utils/tokenizeSearch';
  2. import {useSpanMetricsSeries} from 'sentry/views/starfish/queries/useSpanMetricsSeries';
  3. import type {MetricsProperty} from 'sentry/views/starfish/types';
  4. type Props = {
  5. destination?: string;
  6. enabled?: boolean;
  7. };
  8. const yAxis: MetricsProperty[] = [
  9. 'avg_if(span.self_time,span.op,queue.submit.celery)',
  10. 'avg_if(span.self_time,span.op,queue.task.celery)',
  11. 'count_op(queue.submit.celery)',
  12. 'count_op(queue.task.celery)',
  13. ];
  14. export function useQueuesTimeSeriesQuery({enabled, destination}: Props) {
  15. return useSpanMetricsSeries({
  16. yAxis,
  17. search: destination
  18. ? MutableSearch.fromQueryObject({
  19. transaction: destination, // TODO: This should filter by destination, not transaction
  20. })
  21. : undefined,
  22. referrer: 'api.performance.queues.module-chart',
  23. enabled,
  24. });
  25. }