onDemandMetricAlert.tsx 561 B

123456789101112131415161718
  1. import {isOnDemandAggregate, isOnDemandQueryString} from 'sentry/utils/onDemandMetrics';
  2. import {Dataset} from 'sentry/views/alerts/rules/metric/types';
  3. /**
  4. * We determine that an alert is an on-demand metric alert if the query contains
  5. * one of the tags that are not supported by the standard metrics.
  6. */
  7. export function isOnDemandMetricAlert(
  8. dataset: Dataset,
  9. aggregate: string,
  10. query: string
  11. ): boolean {
  12. if (isOnDemandAggregate(aggregate)) {
  13. return true;
  14. }
  15. return dataset === Dataset.GENERIC_METRICS && isOnDemandQueryString(query);
  16. }