diff --git a/static/app/views/alerts/rules/metric/ruleConditionsForm.tsx b/static/app/views/alerts/rules/metric/ruleConditionsForm.tsx index 44af1731f2fb9c..e19903f5fcc8e1 100644 --- a/static/app/views/alerts/rules/metric/ruleConditionsForm.tsx +++ b/static/app/views/alerts/rules/metric/ruleConditionsForm.tsx @@ -288,6 +288,19 @@ class RuleConditionsForm extends PureComponent { ]); } + if (this.props.dataset === Dataset.EVENTS_ANALYTICS_PLATFORM) { + options = pick(TIME_WINDOW_MAP, [ + TimeWindow.FIVE_MINUTES, + TimeWindow.TEN_MINUTES, + TimeWindow.FIFTEEN_MINUTES, + TimeWindow.THIRTY_MINUTES, + TimeWindow.ONE_HOUR, + TimeWindow.TWO_HOURS, + TimeWindow.FOUR_HOURS, + TimeWindow.ONE_DAY, + ]); + } + return Object.entries(options).map(([value, label]) => ({ value: parseInt(value, 10), label: tct('[timeWindow] interval', { diff --git a/static/app/views/alerts/rules/metric/triggers/chart/index.tsx b/static/app/views/alerts/rules/metric/triggers/chart/index.tsx index 2ecad746b2a64d..940756e3931f65 100644 --- a/static/app/views/alerts/rules/metric/triggers/chart/index.tsx +++ b/static/app/views/alerts/rules/metric/triggers/chart/index.tsx @@ -138,6 +138,24 @@ export const AVAILABLE_TIME_PERIODS: Record = [TimeWindow.ONE_DAY]: [TimePeriod.FOURTEEN_DAYS], }; +const MOST_EAP_TIME_PERIOD = [ + TimePeriod.ONE_DAY, + TimePeriod.THREE_DAYS, + TimePeriod.SEVEN_DAYS, +]; + +const EAP_AVAILABLE_TIME_PERIODS = { + [TimeWindow.ONE_MINUTE]: [], // One minute intervals are not allowed on EAP Alerts + [TimeWindow.FIVE_MINUTES]: MOST_EAP_TIME_PERIOD, + [TimeWindow.TEN_MINUTES]: MOST_EAP_TIME_PERIOD, + [TimeWindow.FIFTEEN_MINUTES]: MOST_EAP_TIME_PERIOD, + [TimeWindow.THIRTY_MINUTES]: MOST_EAP_TIME_PERIOD, + [TimeWindow.ONE_HOUR]: MOST_EAP_TIME_PERIOD, + [TimeWindow.TWO_HOURS]: MOST_EAP_TIME_PERIOD, + [TimeWindow.FOUR_HOURS]: [TimePeriod.SEVEN_DAYS], + [TimeWindow.ONE_DAY]: [TimePeriod.SEVEN_DAYS], +}; + const TIME_WINDOW_TO_SESSION_INTERVAL = { [TimeWindow.THIRTY_MINUTES]: '30m', [TimeWindow.ONE_HOUR]: '1h', @@ -246,6 +264,10 @@ class TriggersChart extends PureComponent { }; } + if (this.props.dataset === Dataset.EVENTS_ANALYTICS_PLATFORM) { + return EAP_AVAILABLE_TIME_PERIODS; + } + return AVAILABLE_TIME_PERIODS; }