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
7 changes: 7 additions & 0 deletions .changeset/brave-meals-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@hyperdx/common-utils": minor
"@hyperdx/api": minor
"@hyperdx/app": minor
---

feat: add support for alert auto-resolve
7 changes: 7 additions & 0 deletions .changeset/friendly-apricots-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@hyperdx/common-utils": patch
"@hyperdx/api": patch
"@hyperdx/app": patch
---

feat: support incident.io integration
7 changes: 7 additions & 0 deletions .changeset/good-feet-jog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@hyperdx/common-utils": patch
"@hyperdx/api": patch
"@hyperdx/app": patch
---

fix: handle group-by alert histories
1 change: 1 addition & 0 deletions packages/api/src/controllers/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import logger from '@/utils/logger';
import { alertSchema } from '@/utils/zod';

export type AlertInput = {
id?: string;
source?: AlertSource;
channel: AlertChannel;
interval: AlertInterval;
Expand Down
8 changes: 8 additions & 0 deletions packages/api/src/models/alertHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface IAlertHistory {
createdAt: Date;
state: AlertState;
lastValues: { startTime: Date; count: number }[];
group?: string; // For group-by alerts, stores the group identifier
}

const AlertHistorySchema = new Schema<IAlertHistory>({
Expand Down Expand Up @@ -40,13 +41,20 @@ const AlertHistorySchema = new Schema<IAlertHistory>({
},
},
],
group: {
type: String,
required: false,
},
});

AlertHistorySchema.index(
{ createdAt: 1 },
{ expireAfterSeconds: ms('30d') / 1000 },
);

// Compound index for querying alert histories by alert and time
// Used by getPreviousAlertHistories and alerts router
// Supports queries like: { alert: id, createdAt: { $lte: date } } with sort { createdAt: -1 }
AlertHistorySchema.index({ alert: 1, createdAt: -1 });

export default mongoose.model<IAlertHistory>(
Expand Down
6 changes: 2 additions & 4 deletions packages/api/src/models/webhook.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { WebhookService } from '@hyperdx/common-utils/dist/types';
import { ObjectId } from 'mongodb';
import mongoose, { Schema } from 'mongoose';

export enum WebhookService {
Slack = 'slack',
Generic = 'generic',
}
export { WebhookService };

interface MongooseMap extends Map<string, string> {
// https://mongoosejs.com/docs/api/map.html#MongooseMap.prototype.toJSON()
Expand Down
Loading
Loading