Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

fix: edit form shows incorrect eval window when 24hours is saved (#1393)

Amol Umbarka2e1c41343b0
diff --git a/frontend/public/locales/en-GB/rules.json b/frontend/public/locales/en-GB/rules.json
index 3e8ceb63cb..0602d7393c 100644
--- a/frontend/public/locales/en-GB/rules.json
+++ b/frontend/public/locales/en-GB/rules.json
@@ -33,6 +33,7 @@
"option_10min": "10 mins",
"option_15min": "15 mins",
"option_60min": "60 mins",
+ "option_4hours": "4 hours",
"option_24hours": "24 hours",
"field_threshold": "Alert Threshold",
"option_allthetimes": "all the times",
diff --git a/frontend/public/locales/en/rules.json b/frontend/public/locales/en/rules.json
index 3e8ceb63cb..0602d7393c 100644
--- a/frontend/public/locales/en/rules.json
+++ b/frontend/public/locales/en/rules.json
@@ -33,6 +33,7 @@
"option_10min": "10 mins",
"option_15min": "15 mins",
"option_60min": "60 mins",
+ "option_4hours": "4 hours",
"option_24hours": "24 hours",
"field_threshold": "Alert Threshold",
"option_allthetimes": "all the times",
diff --git a/frontend/src/container/FormAlertRules/RuleOptions.tsx b/frontend/src/container/FormAlertRules/RuleOptions.tsx
index a4cc5844f4..8bc87c483d 100644
--- a/frontend/src/container/FormAlertRules/RuleOptions.tsx
+++ b/frontend/src/container/FormAlertRules/RuleOptions.tsx
@@ -112,7 +112,8 @@ function RuleOptions({
<Option value="10m0s">{t('option_10min')}</Option>
<Option value="15m0s">{t('option_15min')}</Option>
<Option value="60m0s">{t('option_60min')}</Option>
- <Option value="1440m0s">{t('option_24hours')}</Option>
+ <Option value="4h0m0s">{t('option_4hours')}</Option>
+ <Option value="24h0m0s">{t('option_24hours')}</Option>
</InlineSelect>
);
};
diff --git a/frontend/src/container/FormAlertRules/utils.ts b/frontend/src/container/FormAlertRules/utils.ts
index c6a93d28bc..ea40ce692b 100644
--- a/frontend/src/container/FormAlertRules/utils.ts
+++ b/frontend/src/container/FormAlertRules/utils.ts
@@ -126,7 +126,9 @@ export const toChartInterval = (evalWindow: string | undefined): Time => {
return '30min';
case '60m0s':
return '30min';
- case '1440m0s':
+ case '4h0m0s':
+ return '4hr';
+ case '24h0m0s':
return '1day';
default:
return '5min';
diff --git a/frontend/src/container/TopNav/DateTimeSelection/config.ts b/frontend/src/container/TopNav/DateTimeSelection/config.ts
index 427cb8786e..69bdde40c7 100644
--- a/frontend/src/container/TopNav/DateTimeSelection/config.ts
+++ b/frontend/src/container/TopNav/DateTimeSelection/config.ts
@@ -7,6 +7,7 @@ type ThirtyMin = '30min';
type OneMin = '1min';
type SixHour = '6hr';
type OneHour = '1hr';
+type FourHour = '4hr';
type OneDay = '1day';
type OneWeek = '1week';
type Custom = 'custom';
@@ -17,6 +18,7 @@ export type Time =
| FifteenMin
| ThirtyMin
| OneMin
+ | FourHour
| SixHour
| OneHour
| Custom
diff --git a/frontend/src/lib/getMinMax.ts b/frontend/src/lib/getMinMax.ts
index cd6f26a496..ae830cc06a 100644
--- a/frontend/src/lib/getMinMax.ts
+++ b/frontend/src/lib/getMinMax.ts
@@ -36,8 +36,9 @@ const GetMinMax = (
// one week = one day * 7
const minTimeAgo = getMinAgo({ minutes: 26 * 60 * 7 }).getTime();
minTime = minTimeAgo;
- } else if (interval === '6hr') {
- const minTimeAgo = getMinAgo({ minutes: 6 * 60 }).getTime();
+ } else if (['4hr', '6hr'].includes(interval)) {
+ const h = parseInt(interval.replace('hr', ''), 10);
+ const minTimeAgo = getMinAgo({ minutes: h * 60 }).getTime();
minTime = minTimeAgo;
} else if (interval === 'custom') {
maxTime = (dateTimeRange || [])[1] || 0;