fix: include saved search filters in alert queries#1882
Conversation
🦋 Changeset detectedLatest commit: 1417d1f The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Review✅ No critical issues found. The fix is minimal and correct — adding |
E2E Test Results✅ All tests passed • 87 passed • 3 skipped • 897s
Tests ran across 4 shards in parallel. |
Saved search alerts were ignoring the `filters` field when building the ClickHouse chart config, causing alerts with SQL filters (e.g., ServiceName/SeverityText conditions) to evaluate against unfiltered data.
Add three integration tests verifying that saved search filters are correctly included in alert ClickHouse queries: - filters restrict which logs are counted - filters that match nothing keep alert in OK state - where clause and filters are applied together Also fix DataCloneError in materialized view alert tests by converting Mongoose array to plain objects before structuredClone.
f3cc853 to
15958bb
Compare
| ], | ||
| where: savedSearch.where, | ||
| whereLanguage: savedSearch.whereLanguage, | ||
| filters: savedSearch.filters?.map(f => ({ ...f })), |
There was a problem hiding this comment.
to not copy mongo internal properties that fail tests for some reasons
There was a problem hiding this comment.
Are we sure a spread is enough? Could also do a deep copy via structuredClone
There was a problem hiding this comment.
shallow copy should be sufficient
HDX-3625
## Summary
- Saved search alerts were ignoring the `filters` field when building the ClickHouse chart config in `getChartConfigFromAlert`
- This caused alerts on saved searches with SQL filters (e.g., `ServiceName IN ('hdx-oss-dev-api')`, `SeverityText IN ('info')`) to evaluate against unfiltered data, producing incorrect alert results
- Added `filters: savedSearch.filters` to the chart config so `renderChartConfig` includes filter conditions in the WHERE clause
HDX-3625
## Summary
- Saved search alerts were ignoring the `filters` field when building the ClickHouse chart config in `getChartConfigFromAlert`
- This caused alerts on saved searches with SQL filters (e.g., `ServiceName IN ('hdx-oss-dev-api')`, `SeverityText IN ('info')`) to evaluate against unfiltered data, producing incorrect alert results
- Added `filters: savedSearch.filters` to the chart config so `renderChartConfig` includes filter conditions in the WHERE clause
Co-authored-by: peter-leonov-ch <209667683+peter-leonov-ch@users.noreply.github.com>
HDX-3625
Summary
filtersfield when building the ClickHouse chart config ingetChartConfigFromAlertServiceName IN ('hdx-oss-dev-api'),SeverityText IN ('info')) to evaluate against unfiltered data, producing incorrect alert resultsfilters: savedSearch.filtersto the chart config sorenderChartConfigincludes filter conditions in the WHERE clause