useAvailableDurationAggregates.tsx 649 B

1234567891011121314151617181920
  1. import useOrganization from 'sentry/utils/useOrganization';
  2. import {DEFAULT_DURATION_AGGREGATE} from 'sentry/views/performance/database/settings';
  3. // TODO: Type more strictly, these should be limited to only valid aggregate
  4. // functions
  5. type Result = string[];
  6. export function useAvailableDurationAggregates(): Result {
  7. const organization = useOrganization();
  8. const availableAggregates: string[] = [];
  9. availableAggregates.push(DEFAULT_DURATION_AGGREGATE);
  10. if (organization.features?.includes('performance-database-view-percentiles')) {
  11. availableAggregates.push(...['p50', 'p75', 'p95', 'p99']);
  12. }
  13. return availableAggregates;
  14. }