1234567891011121314151617181920212223242526272829303132 |
- import {Location} from 'history';
- import {Organization} from 'sentry/types';
- import {decodeScalar} from 'sentry/utils/queryString';
- import {getMEPAlertsDataset} from 'sentry/views/alerts/wizard/options';
- import {MetricRule} from '../types';
- export function getMetricDatasetQueryExtras({
- organization,
- location,
- dataset,
- newAlertOrQuery,
- }: {
- dataset: MetricRule['dataset'];
- newAlertOrQuery: boolean;
- organization: Organization;
- location?: Location;
- }) {
- const hasMetricDataset =
- organization.features.includes('metrics-performance-alerts') ||
- organization.features.includes('mep-rollout-flag');
- const disableMetricDataset =
- decodeScalar(location?.query?.disableMetricDataset) === 'true';
- const queryExtras: Record<string, string> =
- hasMetricDataset && !disableMetricDataset
- ? {dataset: getMEPAlertsDataset(dataset, newAlertOrQuery)}
- : {};
- return queryExtras;
- }
|