Skip to content

Commit a4f6856

Browse files
authored
feat: allow tile alerts to use 1m as an interval option (#3327)
## Summary Adding a `1m` option in non-dev environments for tile alert windows. Not sure if it was intentional to make this dev-only, but it'd be really nice for us to be able to use 1m as the window, because in conjunction with consecutive windows, this allows us to do something like 1m window over 5 consecutive windows, which AFAICT is a stricter condition than a single 5m window (1 consecutive), because we'd get 5 samples instead of aggregating across the entire window into one big sample (which means a very noisy single minute could trip a 5m window alert, but maybe not the second minute of five 1m window alerts). Not sure if this reasoning makes sense, so happy to explain more, and thanks! Wasn't sure if a frontend-only change required a changeset, etc. or not - happy to add that
1 parent fd3d947 commit a4f6856

2 files changed

Lines changed: 6 additions & 12 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@hyperdx/app': patch
3+
---
4+
5+
feat: dashboard tile alerts can use a 1 minute interval outside development

‎packages/app/src/utils/alerts.ts‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
differenceInMinutes,
55
sub,
66
} from 'date-fns';
7-
import _ from 'lodash';
87
import { z } from 'zod';
98
import { formatTileAlertDisplayName } from '@hyperdx/common-utils/dist/alerts';
109
import { Granularity } from '@hyperdx/common-utils/dist/core/utils';
@@ -22,7 +21,6 @@ import {
2221
SavedChartConfig,
2322
} from '@hyperdx/common-utils/dist/types';
2423

25-
import { IS_DEV } from '@/config';
2624
import type { AlertsPageItem } from '@/types';
2725

2826
export function intervalToGranularity(interval: AlertInterval) {
@@ -121,16 +119,7 @@ export const ALERT_INTERVAL_OPTIONS: Record<AlertInterval, string> = {
121119
'1d': '1 day',
122120
};
123121

124-
export const TILE_ALERT_INTERVAL_OPTIONS = _.pick(ALERT_INTERVAL_OPTIONS, [
125-
...(IS_DEV ? (['1m'] as const) : []),
126-
'5m',
127-
'15m',
128-
'30m',
129-
'1h',
130-
'6h',
131-
'12h',
132-
'1d',
133-
]);
122+
export const TILE_ALERT_INTERVAL_OPTIONS = ALERT_INTERVAL_OPTIONS;
134123

135124
export const ALERT_CHANNEL_OPTIONS: Record<AlertChannelType, string> = {
136125
webhook: 'Webhook',

0 commit comments

Comments
 (0)