Browse Source

feat(ddm): Move ddm-alerts to ddm-ui feature flag (#60963)

Enable custom metric based alerts for everybody with the `ddm-ui`
feature flag.
ArthurKnaus 1 year ago
parent
commit
e3bafed534

+ 1 - 1
static/app/views/alerts/filterBar.tsx

@@ -73,7 +73,7 @@ function FilterBar({
             <SegmentedControl.Item key={DatasetOption.ALL}>
               {t('All')}
             </SegmentedControl.Item>
-            <SegmentedControl.Item key={DatasetOption.ERRORS}>
+            <SegmentedControl.Item disabled key={DatasetOption.ERRORS}>
               {t('Errors')}
             </SegmentedControl.Item>
             <SegmentedControl.Item key={DatasetOption.SESSIONS}>

+ 2 - 3
static/app/views/alerts/rules/metric/ruleConditionsForm.tsx

@@ -25,7 +25,7 @@ import {t, tct} from 'sentry/locale';
 import {space} from 'sentry/styles/space';
 import {Environment, Organization, Project, SelectValue} from 'sentry/types';
 import {getDisplayName} from 'sentry/utils/environment';
-import {hasDDMExperimentalFeature} from 'sentry/utils/metrics/features';
+import {hasDDMFeature} from 'sentry/utils/metrics/features';
 import {getMRI} from 'sentry/utils/metrics/mri';
 import {getOnDemandKeys, isOnDemandQueryString} from 'sentry/utils/onDemandMetrics';
 import {hasOnDemandMetricAlertFeature} from 'sentry/utils/onDemandMetrics/features';
@@ -461,8 +461,7 @@ class RuleConditionsForm extends PureComponent<Props, State> {
                 flexibleControlStateSize
               >
                 {({onChange, onBlur, onKeyDown, initialData, value}) => {
-                  return hasDDMExperimentalFeature(organization) &&
-                    alertType === 'custom_metrics' ? (
+                  return hasDDMFeature(organization) && alertType === 'custom_metrics' ? (
                     <MetricSearchBar
                       mri={getMRI(aggregate)}
                       projectIds={[project.id]}

+ 2 - 2
static/app/views/alerts/rules/metric/ruleForm.tsx

@@ -32,7 +32,7 @@ import {metric, trackAnalytics} from 'sentry/utils/analytics';
 import type EventView from 'sentry/utils/discover/eventView';
 import {
   getForceMetricsLayerQueryExtras,
-  hasDDMExperimentalFeature,
+  hasDDMFeature,
 } from 'sentry/utils/metrics/features';
 import {DEFAULT_METRIC_ALERT_FIELD, formatMRIField} from 'sentry/utils/metrics/mri';
 import {isOnDemandQueryString} from 'sentry/utils/onDemandMetrics';
@@ -1090,7 +1090,7 @@ class RuleFormContainer extends DeprecatedAsyncComponent<Props, State> {
               thresholdChart={wizardBuilderChart}
               onFilterSearch={this.handleFilterUpdate}
               allowChangeEventTypes={
-                hasDDMExperimentalFeature(organization)
+                hasDDMFeature(organization)
                   ? dataset === Dataset.ERRORS
                   : dataset === Dataset.ERRORS || alertType === 'custom_transactions'
               }

+ 5 - 5
static/app/views/alerts/rules/metric/wizardField.tsx

@@ -7,7 +7,7 @@ import {t} from 'sentry/locale';
 import {space} from 'sentry/styles/space';
 import {Organization, Project} from 'sentry/types';
 import {explodeFieldString, generateFieldAsString} from 'sentry/utils/discover/fields';
-import {hasDDMExperimentalFeature} from 'sentry/utils/metrics/features';
+import {hasDDMFeature} from 'sentry/utils/metrics/features';
 import MriField from 'sentry/views/alerts/rules/metric/mriField';
 import {Dataset} from 'sentry/views/alerts/rules/metric/types';
 import {
@@ -105,7 +105,7 @@ export default function WizardField({
           label: AlertWizardAlertNames.cls,
           value: 'cls',
         },
-        ...(hasDDMExperimentalFeature(organization)
+        ...(hasDDMFeature(organization)
           ? [
               {
                 label: AlertWizardAlertNames.custom_transactions,
@@ -116,9 +116,9 @@ export default function WizardField({
       ],
     },
     {
-      label: hasDDMExperimentalFeature(organization) ? t('METRICS') : t('CUSTOM'),
+      label: hasDDMFeature(organization) ? t('METRICS') : t('CUSTOM'),
       options: [
-        hasDDMExperimentalFeature(organization)
+        hasDDMFeature(organization)
           ? {
               label: AlertWizardAlertNames.custom_metrics,
               value: 'custom_metrics',
@@ -179,7 +179,7 @@ export default function WizardField({
                 model.setValue('alertType', option.value);
               }}
             />
-            {hasDDMExperimentalFeature(organization) && alertType === 'custom_metrics' ? (
+            {hasDDMFeature(organization) && alertType === 'custom_metrics' ? (
               <MriField
                 project={project}
                 aggregate={aggregate}

+ 4 - 6
static/app/views/alerts/wizard/options.tsx

@@ -11,7 +11,7 @@ import {
   SpanOpBreakdown,
   WebVital,
 } from 'sentry/utils/fields';
-import {hasDDMExperimentalFeature} from 'sentry/utils/metrics/features';
+import {hasDDMFeature} from 'sentry/utils/metrics/features';
 import {DEFAULT_METRIC_ALERT_FIELD} from 'sentry/utils/metrics/mri';
 import {ON_DEMAND_METRICS_UNSUPPORTED_TAGS} from 'sentry/utils/onDemandMetrics/constants';
 import {shouldShowOnDemandMetricAlertUI} from 'sentry/utils/onDemandMetrics/features';
@@ -103,14 +103,12 @@ export const getAlertWizardCategories = (org: Organization): AlertWizardCategory
       'lcp',
       'fid',
       'cls',
-      ...(hasDDMExperimentalFeature(org)
-        ? (['custom_transactions'] satisfies AlertType[])
-        : []),
+      ...(hasDDMFeature(org) ? (['custom_transactions'] satisfies AlertType[]) : []),
     ],
   },
   {
-    categoryHeading: hasDDMExperimentalFeature(org) ? t('Metrics') : t('Custom'),
-    options: [hasDDMExperimentalFeature(org) ? 'custom_metrics' : 'custom_transactions'],
+    categoryHeading: hasDDMFeature(org) ? t('Metrics') : t('Custom'),
+    options: [hasDDMFeature(org) ? 'custom_metrics' : 'custom_transactions'],
   },
 ];
 

+ 2 - 3
static/app/views/ddm/contextMenu.tsx

@@ -9,7 +9,7 @@ import {t} from 'sentry/locale';
 import {space} from 'sentry/styles/space';
 import {Organization} from 'sentry/types';
 import {MetricDisplayType, MetricsQuery} from 'sentry/utils/metrics';
-import {hasDDMExperimentalFeature, hasDDMFeature} from 'sentry/utils/metrics/features';
+import {hasDDMFeature} from 'sentry/utils/metrics/features';
 import {MRIToField, parseMRI} from 'sentry/utils/metrics/mri';
 import useOrganization from 'sentry/utils/useOrganization';
 import useRouter from 'sentry/utils/useRouter';
@@ -47,8 +47,7 @@ export function MetricWidgetContextMenu({metricsQuery, displayType}: ContextMenu
         {
           key: 'add-dashoard',
           label: t('Add to Dashboard'),
-          disabled:
-            !hasDDMExperimentalFeature(organization) || !handleAddQueryToDashboard,
+          disabled: !handleAddQueryToDashboard,
           onAction: handleAddQueryToDashboard,
         },
       ]}