diff --git a/cypress/fixtures/sample_composite_level_monitor.json b/cypress/fixtures/sample_composite_level_monitor.json index 9b1f67bf4..8e6d09a13 100644 --- a/cypress/fixtures/sample_composite_level_monitor.json +++ b/cypress/fixtures/sample_composite_level_monitor.json @@ -48,7 +48,7 @@ "name": "sample_channel", "destination_id": "6dYFw4gB2qeAWe54NgyL", "message_template": { - "source": "Monitor {{ctx.monitor.name}} just entered alert status. Please investigate the issue.\n - Trigger: {{ctx.trigger.name}}\n - Severity: {{ctx.trigger.severity}}\n - Period start: {{ctx.periodStart}}\n - Period end: {{ctx.periodEnd}}", + "source": "Monitor {{ctx.monitor.name}} just entered alert status. Please investigate the issue.\n - Trigger: {{ctx.trigger.name}}\n - Severity: {{ctx.trigger.severity}}\n - Period start: {{ctx.periodStart}} UTC\n - Period end: {{ctx.periodEnd}} UTC", "lang": "mustache" }, "throttle_enabled": false, diff --git a/public/pages/CreateTrigger/components/Action/actions/Message.test.js b/public/pages/CreateTrigger/components/Action/actions/Message.test.js index 047a2bec5..0d08d7e09 100644 --- a/public/pages/CreateTrigger/components/Action/actions/Message.test.js +++ b/public/pages/CreateTrigger/components/Action/actions/Message.test.js @@ -19,7 +19,7 @@ function getRenderWrapper(customProps = {}) { action={{ message_template: { source: - 'Monitor {{ctx.monitor.name}} just entered alert status. Please investigate the issue.\n- Trigger: {{ctx.trigger.name}}\n- Severity: {{ctx.trigger.severity}}\n- Period start: {{ctx.periodStart}}\n- Period end: {{ctx.periodEnd}}', + 'Monitor {{ctx.monitor.name}} just entered alert status. Please investigate the issue.\n- Trigger: {{ctx.trigger.name}}\n- Severity: {{ctx.trigger.severity}}\n- Period start: {{ctx.periodStart}} UTC\n- Period end: {{ctx.periodEnd}} UTC', lang: 'mustache', }, }} diff --git a/public/pages/CreateTrigger/utils/constants.js b/public/pages/CreateTrigger/utils/constants.js index dd8a59165..7c6af02e3 100644 --- a/public/pages/CreateTrigger/utils/constants.js +++ b/public/pages/CreateTrigger/utils/constants.js @@ -11,8 +11,8 @@ export const DEFAULT_MESSAGE_SOURCE = { Monitor {{ctx.monitor.name}} just entered alert status. Please investigate the issue. - Trigger: {{ctx.trigger.name}} - Severity: {{ctx.trigger.severity}} - - Period start: {{ctx.periodStart}} - - Period end: {{ctx.periodEnd}} + - Period start: {{ctx.periodStart}} UTC + - Period end: {{ctx.periodEnd}} UTC - Deduped Alerts: {{#ctx.dedupedAlerts}} @@ -33,8 +33,8 @@ export const DEFAULT_MESSAGE_SOURCE = { Monitor {{ctx.monitor.name}} just entered alert status. Please investigate the issue. - Trigger: {{ctx.trigger.name}} - Severity: {{ctx.trigger.severity}} - - Period start: {{ctx.periodStart}} - - Period end: {{ctx.periodEnd}} + - Period start: {{ctx.periodStart}} UTC + - Period end: {{ctx.periodEnd}} UTC `.trim(), }; diff --git a/public/pages/CreateTrigger/utils/helper.js b/public/pages/CreateTrigger/utils/helper.js index 83d2225d0..7721cdf40 100644 --- a/public/pages/CreateTrigger/utils/helper.js +++ b/public/pages/CreateTrigger/utils/helper.js @@ -74,8 +74,10 @@ export const getTriggerContext = (executeResponse, monitor, values, triggerIndex if (_.isArray(trigger) && triggerIndex >= 0) trigger = trigger[triggerIndex]; return { - periodStart: moment.utc(_.get(executeResponse, 'period_start', Date.now())).tz(getTimeZone()).format(), - periodEnd: moment.utc(_.get(executeResponse, 'period_end', Date.now())).tz(getTimeZone()).format(), + // Backend only supports, UTC timezone. + // Don't use user's local timezone. + periodStart: moment.utc(_.get(executeResponse, 'period_start', Date.now())).format(), + periodEnd: moment.utc(_.get(executeResponse, 'period_end', Date.now())).format(), results: [_.get(executeResponse, 'input_results.results[0]')].filter((result) => !!result), trigger: trigger, alert: null,