perf: add index for pulling alert histories (GET alerts endpoint) (#221)

This commit is contained in:
Warren 2024-01-10 18:36:00 -08:00 committed by GitHub
parent 0ce932847f
commit bfb08f89e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View file

@ -0,0 +1,6 @@
---
'@hyperdx/api': patch
'@hyperdx/app': patch
---
perf: add index for pulling alert histories (GET alerts endpoint)

View file

@ -47,6 +47,8 @@ AlertHistorySchema.index(
{ expireAfterSeconds: ms('30d') / 1000 },
);
AlertHistorySchema.index({ alert: 1, createdAt: -1 });
export default mongoose.model<IAlertHistory>(
'AlertHistory',
AlertHistorySchema,