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.

feat: add 1 month option in time range (#5639)

Yunus M61e6316736f2
diff --git a/frontend/src/container/NewWidget/RightContainer/timeItems.ts b/frontend/src/container/NewWidget/RightContainer/timeItems.ts
index dd6f8cd552..dc4008d898 100644
--- a/frontend/src/container/NewWidget/RightContainer/timeItems.ts
+++ b/frontend/src/container/NewWidget/RightContainer/timeItems.ts
@@ -36,6 +36,10 @@ export const timeItems: timePreferance[] = [
name: 'Last 1 week',
enum: 'LAST_1_WEEK',
},
+ {
+ name: 'Last 1 month',
+ enum: 'LAST_1_MONTH',
+ },
];
export interface timePreferance {
@@ -52,7 +56,8 @@ export type timePreferenceType =
| LAST_6_HR
| LAST_1_DAY
| LAST_3_DAYS
- | LAST_1_WEEK;
+ | LAST_1_WEEK
+ | LAST_1_MONTH;
type GLOBAL_TIME = 'GLOBAL_TIME';
type LAST_5_MIN = 'LAST_5_MIN';
@@ -63,5 +68,6 @@ type LAST_6_HR = 'LAST_6_HR';
type LAST_1_DAY = 'LAST_1_DAY';
type LAST_3_DAYS = 'LAST_3_DAYS';
type LAST_1_WEEK = 'LAST_1_WEEK';
+type LAST_1_MONTH = 'LAST_1_MONTH';
export default timeItems;
diff --git a/frontend/src/container/TopNav/DateTimeSelectionV2/config.ts b/frontend/src/container/TopNav/DateTimeSelectionV2/config.ts
index 19a3e8c431..473107265e 100644
--- a/frontend/src/container/TopNav/DateTimeSelectionV2/config.ts
+++ b/frontend/src/container/TopNav/DateTimeSelectionV2/config.ts
@@ -19,6 +19,7 @@ type TenDay = '10d';
type OneWeek = '1w';
type TwoWeek = '2w';
type SixWeek = '6w';
+type OneMonth = '1month';
type TwoMonths = '2months';
type Custom = 'custom';
@@ -42,6 +43,7 @@ export type Time =
| TwelveHour
| TenDay
| TwoWeek
+ | OneMonth
| TwoMonths;
export type TimeUnit = 'm' | 'h' | 'd' | 'w';
@@ -57,6 +59,7 @@ export const Options: Option[] = [
{ value: '1d', label: 'Last 1 day' },
{ value: '3d', label: 'Last 3 days' },
{ value: '1w', label: 'Last 1 week' },
+ { value: '1month', label: 'Last 1 month' },
{ value: 'custom', label: 'Custom' },
];
@@ -95,6 +98,7 @@ export const RelativeDurationOptions: Option[] = [
{ value: '1d', label: 'Last 1 day' },
{ value: '3d', label: 'Last 3 days' },
{ value: '1w', label: 'Last 1 week' },
+ { value: '1month', label: 'Last 1 month' },
];
export const RelativeDurationSuggestionOptions: Option[] = [
diff --git a/frontend/src/lib/getMinMax.ts b/frontend/src/lib/getMinMax.ts
index 4a5076b066..d2062f5a4c 100644
--- a/frontend/src/lib/getMinMax.ts
+++ b/frontend/src/lib/getMinMax.ts
@@ -99,6 +99,10 @@ const GetMinMax = (
// six week = one day * 42
const minTimeAgo = getMinAgo({ minutes: 24 * 60 * 42 }).getTime();
minTime = minTimeAgo;
+ } else if (interval === '1month') {
+ // one month = one day * 30
+ const minTimeAgo = getMinAgo({ minutes: 24 * 60 * 30 }).getTime();
+ minTime = minTimeAgo;
} else if (interval === '2months') {
// two months = one day * 60
const minTimeAgo = getMinAgo({ minutes: 24 * 60 * 60 }).getTime();
diff --git a/frontend/src/lib/getStartAndEndTime/index.ts b/frontend/src/lib/getStartAndEndTime/index.ts
index ee012858d7..43b7d2f6d6 100644
--- a/frontend/src/lib/getStartAndEndTime/index.ts
+++ b/frontend/src/lib/getStartAndEndTime/index.ts
@@ -56,6 +56,10 @@ const GetStartAndEndTime = ({
return calculateStartAndEndTime(24 * 60 * 7, endString);
}
+ if (type === 'LAST_1_MONTH') {
+ return calculateStartAndEndTime(24 * 60 * 30, endString);
+ }
+
return {
start: getMicroSeconds({ time: minTime / 1000000 }),
end: getMicroSeconds({ time: maxTime / 1000000 }),