useResourcePageQuery.ts 794 B

1234567891011121314151617181920212223242526
  1. import type {Sort} from 'sentry/utils/discover/fields';
  2. import {useSpanTransactionMetrics} from 'sentry/views/starfish/queries/useSpanTransactionMetrics';
  3. import {SpanMetricsField} from 'sentry/views/starfish/types';
  4. const {HTTP_RESPONSE_CONTENT_LENGTH, RESOURCE_RENDER_BLOCKING_STATUS} = SpanMetricsField;
  5. export const useResourcePagesQuery = (
  6. groupId: string,
  7. {
  8. sort,
  9. cursor,
  10. renderBlockingStatus,
  11. }: {sort: Sort; cursor?: string; renderBlockingStatus?: string}
  12. ) => {
  13. return useSpanTransactionMetrics(
  14. {
  15. 'span.group': groupId,
  16. ...(renderBlockingStatus
  17. ? {[RESOURCE_RENDER_BLOCKING_STATUS]: renderBlockingStatus}
  18. : {}),
  19. },
  20. [sort],
  21. cursor,
  22. [`avg(${HTTP_RESPONSE_CONTENT_LENGTH})`, RESOURCE_RENDER_BLOCKING_STATUS]
  23. );
  24. };