Skip to content

[Security Solution] Add "alerts_candidate_count" rule execution metric#259917

Merged
maximpn merged 4 commits intoelastic:mainfrom
maximpn:add-rule-execution-metrics
Mar 31, 2026
Merged

[Security Solution] Add "alerts_candidate_count" rule execution metric#259917
maximpn merged 4 commits intoelastic:mainfrom
maximpn:add-rule-execution-metrics

Conversation

@maximpn
Copy link
Copy Markdown
Contributor

@maximpn maximpn commented Mar 27, 2026

Addresses: #255513
Relates to: #257203

Summary

This PR adds logic to calculate alerts_candidate_count rule execution metric. The mapping was added in #257203.

Details

alerts_candidate_count rule execution metric represents the number of detected alerts before any alerts suppression is applied. Alerts may be suppressed when alerts suppression by some field(s) in a certain time window is configured. Or it's a duplicate alert so Elasticsearch won't index alert documents with the same ids.

The calculation logic varies based on the rule type but the logic described in the previous paragraph persists.

@maximpn maximpn self-assigned this Mar 27, 2026
@maximpn maximpn added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Feature:Rule Monitoring Security Solution Detection Rule Monitoring area Team:Detection Rule Management Security Detection Rule Management Team v9.4.0 Feature:DE O11y labels Mar 27, 2026
@maximpn
Copy link
Copy Markdown
Contributor Author

maximpn commented Mar 27, 2026

/ci

@maximpn maximpn changed the title [Security Solution] Add "alerts_candidate_count" rule execution metrics [Security Solution] Add "alerts_candidate_count" rule execution metric Mar 27, 2026
@maximpn
Copy link
Copy Markdown
Contributor Author

maximpn commented Mar 27, 2026

/ci

@maximpn maximpn marked this pull request as ready for review March 27, 2026 11:59
@maximpn maximpn requested review from a team as code owners March 27, 2026 11:59
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/security-detection-rule-management (Team:Detection Rule Management)

@banderror banderror added release_note:enhancement and removed release_note:skip Skip the PR/issue when compiling release notes labels Mar 27, 2026
Copy link
Copy Markdown
Contributor

@nikitaindik nikitaindik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read through the code and tested that alerts_suppressed_count is calculated correctly for each rule type.

On a high level, for each rule type, I created two rules: one with suppression, one without. Then for each rule I ingested a few source events, ran a rule, inspected metrics.alerts_candidate_count and metrics.alerts_suppressed_count on the the resulting "execute" events in the event log. I expected alerts_candidate_count to be equal to the number of events I ingested and more than alerts_suppressed_count.

  • ✅ Query
  • ✅ EQL
  • ✅ ESQL
  • ✅ New Terms
  • ✅ Indicator Match
  • ✅ Threshold
  • ✅ ML

@elastic elastic deleted a comment from elasticmachine Mar 30, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

cc @maximpn

@maximpn maximpn merged commit 2d241e7 into elastic:main Mar 31, 2026
18 checks passed
@maximpn maximpn deleted the add-rule-execution-metrics branch March 31, 2026 06:44
mbondyra added a commit to mbondyra/kibana that referenced this pull request Mar 31, 2026
…e_for_children6

* commit '3402744f63ca1196e97b11ffac4e7f7efab240df': (80 commits)
  [PerUserAuth] Add EARS auth type for Connectors V2 (elastic#253695)
  Fix `@elastic/eui/require-aria-label-for-modals` lint violations across `@elastic/kibana-core` files (elastic#259757)
  [Entity Analytics][Leads generation][4] Add API routes, LeadDataClient, and async generation (elastic#257046)
  [Agent Builder] Agent-centric UX redesign (elastic#258005)
  fix query streams failing test (elastic#260277)
  [Lens as code] Add list layout to the new API (elastic#259967)
  [FTR] Add warning comments to deployment-agnostic FTR base configs (elastic#260018)
  [Discover][Logs profile] Fix missing search highlights (elastic#260056)
  Plugin system: safe deletion (elastic#259038)
  [Infra] Fix Hosts filter options to match selected schema (elastic#259825)
  Manual Entity Resolution and flyout representation (elastic#260162)
  [Cascade] Handle grouping on fields with unset values (elastic#260033)
  [Fleet] generate OTel config for integration packages with otelcol inputs (elastic#259968)
  [Search] Switch over to V2 index management details (elastic#259866)
  [inference] increase timeout for ES inference calls (elastic#260382)
  [ES|QL] Enable subqueries (elastic#257455)
  [ES|QL] Change Point order free options (elastic#260282)
  [Auth] Added authentication strategy for UIAM OAuth (elastic#256182)
  [Security Solution] Add "alerts_candidate_count" rule execution metric (elastic#259917)
  [api-docs] 2026-03-31 Daily api_docs build (elastic#260380)
  ...
jeramysoucy pushed a commit to jeramysoucy/kibana that referenced this pull request Apr 1, 2026
elastic#259917)

**Addresses:** elastic#255513
**Relates to:** elastic#257203

## Summary

This PR adds logic to calculate `alerts_candidate_count` rule execution metric. The mapping was added in elastic#257203.

## Details

`alerts_candidate_count` rule execution metric represents the number of detected alerts before any alerts suppression is applied. Alerts may be suppressed when alerts suppression by some field(s) in a certain time window is configured. Or it's a duplicate alert so Elasticsearch won't index alert documents with the same ids.

The calculation logic varies based on the rule type but the logic described in the previous paragraph persists.
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this pull request Apr 2, 2026
elastic#259917)

**Addresses:** elastic#255513
**Relates to:** elastic#257203

## Summary

This PR adds logic to calculate `alerts_candidate_count` rule execution metric. The mapping was added in elastic#257203.

## Details

`alerts_candidate_count` rule execution metric represents the number of detected alerts before any alerts suppression is applied. Alerts may be suppressed when alerts suppression by some field(s) in a certain time window is configured. Or it's a duplicate alert so Elasticsearch won't index alert documents with the same ids.

The calculation logic varies based on the rule type but the logic described in the previous paragraph persists.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:DE O11y Feature:Rule Monitoring Security Solution Detection Rule Monitoring area release_note:enhancement Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants