Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/tile-alerts-1m-interval.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperdx/app': patch
---

feat: dashboard tile alerts can use a 1 minute interval outside development
13 changes: 1 addition & 12 deletions packages/app/src/utils/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
differenceInMinutes,
sub,
} from 'date-fns';
import _ from 'lodash';
import { z } from 'zod';
import { formatTileAlertDisplayName } from '@hyperdx/common-utils/dist/alerts';
import { Granularity } from '@hyperdx/common-utils/dist/core/utils';
Expand All @@ -22,7 +21,6 @@ import {
SavedChartConfig,
} from '@hyperdx/common-utils/dist/types';

import { IS_DEV } from '@/config';
import type { AlertsPageItem } from '@/types';

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

export const TILE_ALERT_INTERVAL_OPTIONS = _.pick(ALERT_INTERVAL_OPTIONS, [
...(IS_DEV ? (['1m'] as const) : []),
'5m',
'15m',
'30m',
'1h',
'6h',
'12h',
'1d',
]);
export const TILE_ALERT_INTERVAL_OPTIONS = ALERT_INTERVAL_OPTIONS;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just aliased this instead of refactoring everywhere in case we wanted them to diverge in the future, but happy to also remove TILE_ALERT_INTERVAL_OPTIONS and use ALERT_INTERVAL_OPTIONS everywhere instead!

Comment thread
mrkaye97 marked this conversation as resolved.
Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — TILE_ALERT_INTERVAL_OPTIONS is now just another name for ALERT_INTERVAL_OPTIONS, so the tile/search branch in EditAlertModal does nothing

Delete the alias and use ALERT_INTERVAL_OPTIONS in its two callers. In packages/app/src/components/alerts/EditAlertModal.tsx:224-226, replace the isChartAlert ? TILE_ALERT_INTERVAL_OPTIONS : ALERT_INTERVAL_OPTIONS ternary (both branches are the same object) with ALERT_INTERVAL_OPTIONS. In packages/app/src/components/DBEditTimeChartForm/TileAlertEditor.tsx:47,88,224, switch the imports and uses to ALERT_INTERVAL_OPTIONS. As it stands, the code suggests tile alerts have their own interval list, but that list is now the same object as the general one.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond


export const ALERT_CHANNEL_OPTIONS: Record<AlertChannelType, string> = {
webhook: 'Webhook',
Expand Down
Loading