Skip to content

Commit

Permalink
perf: add index for pulling alert histories (GET alerts endpoint) (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
wrn14897 committed Jan 11, 2024
1 parent 0ce9328 commit bfb08f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/tall-rats-hunt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@hyperdx/api': patch
'@hyperdx/app': patch
---

perf: add index for pulling alert histories (GET alerts endpoint)
2 changes: 2 additions & 0 deletions packages/api/src/models/alertHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ AlertHistorySchema.index(
{ expireAfterSeconds: ms('30d') / 1000 },
);

AlertHistorySchema.index({ alert: 1, createdAt: -1 });

export default mongoose.model<IAlertHistory>(
'AlertHistory',
AlertHistorySchema,
Expand Down

0 comments on commit bfb08f8

Please sign in to comment.