useAvailableDurationAggregates.tsx 620 B

12345678910111213141516171819
  1. import useOrganization from 'sentry/utils/useOrganization';
  2. import {DEFAULT_DURATION_AGGREGATE} from 'sentry/views/performance/database/settings';
  3. import type {Aggregate} from 'sentry/views/starfish/types';
  4. type Result = Aggregate[];
  5. export function useAvailableDurationAggregates(): Result {
  6. const organization = useOrganization();
  7. const availableAggregates: Aggregate[] = [];
  8. availableAggregates.push(DEFAULT_DURATION_AGGREGATE);
  9. if (organization.features?.includes('performance-database-view-percentiles')) {
  10. availableAggregates.push('p50', 'p75', 'p95', 'p99');
  11. }
  12. return availableAggregates;
  13. }