Skip to content

fix(alerts): on demand migration ui #58508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions static/app/views/alerts/rules/metric/ruleForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -831,9 +831,17 @@ class RuleFormContainer extends DeprecatedAsyncComponent<Props, State> {
organization.features.includes('mep-rollout-flag') ||
hasOnDemandMetricAlertFeature(organization);

// this prevents new transaction alerts from being created
const isCreatingRule = !ruleId;

if (isCreatingRule && hasMetricsFeatureFlags && dataset === Dataset.TRANSACTIONS) {
// this forces migration of existing transaction alerts to generic metrics
const isMigrating = hasMigrationFeatureFlag(organization);

if (
(isCreatingRule || isMigrating) &&
hasMetricsFeatureFlags &&
dataset === Dataset.TRANSACTIONS
) {
return Dataset.GENERIC_METRICS;
}
return dataset;
Expand Down Expand Up @@ -980,7 +988,7 @@ class RuleFormContainer extends DeprecatedAsyncComponent<Props, State> {
const submitDisabled = formDisabled || !this.state.isQueryValid;

const showMigrationWarning =
hasMigrationFeatureFlag(organization) && ruleNeedsMigration(rule);
!!ruleId && hasMigrationFeatureFlag(organization) && ruleNeedsMigration(rule);

return (
<Main fullWidth>
Expand Down
7 changes: 4 additions & 3 deletions static/app/views/alerts/wizard/options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
WebVital,
} from 'sentry/utils/fields';
import {ON_DEMAND_METRICS_UNSUPPORTED_TAGS} from 'sentry/utils/onDemandMetrics/constants';
import {shouldShowOnDemandMetricAlertUI} from 'sentry/utils/onDemandMetrics/features';
import {
Dataset,
EventTypes,
Expand Down Expand Up @@ -259,8 +260,8 @@ export function datasetSupportedTags(
}

function transactionSupportedTags(org: Organization) {
if (org.features.includes('on-demand-metrics-extraction')) {
// on-demand metrics support all tags
if (shouldShowOnDemandMetricAlertUI(org)) {
// on-demand metrics support all tags, except the ones defined in ommited tags
return undefined;
}
return TRANSACTION_SUPPORTED_TAGS;
Expand Down Expand Up @@ -304,7 +305,7 @@ export function datasetOmittedTags(
}

function transactionOmittedTags(org: Organization) {
if (org.features.includes('on-demand-metrics-extraction')) {
if (shouldShowOnDemandMetricAlertUI(org)) {
return [...ON_DEMAND_METRICS_UNSUPPORTED_TAGS];
}
return org.features.includes('alert-allow-indexed')
Expand Down