-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use RuleDataReader to query for threshold signal history (#129763)
- Loading branch information
1 parent
5fb9576
commit 4373d0a
Showing
9 changed files
with
253 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
...etection_engine/signals/threshold/__snapshots__/get_threshold_signal_history.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
85 changes: 0 additions & 85 deletions
85
...solution/server/lib/detection_engine/signals/threshold/find_previous_threshold_signals.ts
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
...lution/server/lib/detection_engine/signals/threshold/get_threshold_signal_history.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { buildPreviousThresholdAlertRequest } from './get_threshold_signal_history'; | ||
|
||
describe('buildPreviousThresholdAlertRequest', () => { | ||
it('should generate a proper request when bucketByFields is empty', async () => { | ||
const bucketByFields: string[] = []; | ||
const to = 'now'; | ||
const from = 'now-6m'; | ||
const ruleId = 'threshold-rule'; | ||
|
||
expect( | ||
buildPreviousThresholdAlertRequest({ from, to, ruleId, bucketByFields }) | ||
).toMatchSnapshot(); | ||
}); | ||
|
||
it('should generate a proper request when bucketByFields contains multiple fields', async () => { | ||
const bucketByFields: string[] = ['host.name', 'user.name']; | ||
const to = 'now'; | ||
const from = 'now-6m'; | ||
const ruleId = 'threshold-rule'; | ||
|
||
expect( | ||
buildPreviousThresholdAlertRequest({ from, to, ruleId, bucketByFields }) | ||
).toMatchSnapshot(); | ||
}); | ||
}); |
Oops, something went wrong.