[8.9] Flaky test: Detection rule telemetry #162407 (#162681) (#163675)

# Backport

This will backport the following commits from `main` to `8.9`:
- [Flaky test: Detection rule telemetry #162407
(#162681)](https://github.com/elastic/kibana/pull/162681)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Ievgen
Sorokopud","email":"ievgen.sorokopud@elastic.co"},"sourceCommit":{"committedDate":"2023-07-31T09:43:54Z","message":"Flaky
test: Detection rule telemetry #162407 (#162681)\n\n##
Summary\r\n\r\nOriginal ticket:
https://github.com/elastic/kibana/issues/156088\r\n\r\nIt looks like
flakiness happens due to another rule from previous test\r\ncase being
scheduled by alerting framework and running even after we\r\ndeleted it
(since we called delete rule after it was scheduled). That\r\nrule
scheduled earlier produces some unexpected artifacts in
metrics,\r\nspecifically `stats.detection_rules.detection_rule_status`
where\r\noccasionally see\r\n\r\n<img width=\"1255\" alt=\"Screenshot
2023-07-25 at 15 13
29\"\r\nsrc=\"5d1cc334-25b5-4bf2-8822-c9858a0b72bf\">\r\n\r\nSince,
in this test case the rule is disabled, we should not see
this\r\ndata.\r\n\r\nAs a fix, we decided to test against specific
metrics attributes\r\n`stats.detection_rules.detection_rule_usage` which
we expect
being\r\nupdated.","sha":"9036b15be0c75e3541738d6d121bc2583affd447","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","test-failure-flaky","backport:prev-minor","Team:Detection
Engine","v8.10.0"],"number":162681,"url":"https://github.com/elastic/kibana/pull/162681","mergeCommit":{"message":"Flaky
test: Detection rule telemetry #162407 (#162681)\n\n##
Summary\r\n\r\nOriginal ticket:
https://github.com/elastic/kibana/issues/156088\r\n\r\nIt looks like
flakiness happens due to another rule from previous test\r\ncase being
scheduled by alerting framework and running even after we\r\ndeleted it
(since we called delete rule after it was scheduled). That\r\nrule
scheduled earlier produces some unexpected artifacts in
metrics,\r\nspecifically `stats.detection_rules.detection_rule_status`
where\r\noccasionally see\r\n\r\n<img width=\"1255\" alt=\"Screenshot
2023-07-25 at 15 13
29\"\r\nsrc=\"5d1cc334-25b5-4bf2-8822-c9858a0b72bf\">\r\n\r\nSince,
in this test case the rule is disabled, we should not see
this\r\ndata.\r\n\r\nAs a fix, we decided to test against specific
metrics attributes\r\n`stats.detection_rules.detection_rule_usage` which
we expect
being\r\nupdated.","sha":"9036b15be0c75e3541738d6d121bc2583affd447"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/162681","number":162681,"mergeCommit":{"message":"Flaky
test: Detection rule telemetry #162407 (#162681)\n\n##
Summary\r\n\r\nOriginal ticket:
https://github.com/elastic/kibana/issues/156088\r\n\r\nIt looks like
flakiness happens due to another rule from previous test\r\ncase being
scheduled by alerting framework and running even after we\r\ndeleted it
(since we called delete rule after it was scheduled). That\r\nrule
scheduled earlier produces some unexpected artifacts in
metrics,\r\nspecifically `stats.detection_rules.detection_rule_status`
where\r\noccasionally see\r\n\r\n<img width=\"1255\" alt=\"Screenshot
2023-07-25 at 15 13
29\"\r\nsrc=\"5d1cc334-25b5-4bf2-8822-c9858a0b72bf\">\r\n\r\nSince,
in this test case the rule is disabled, we should not see
this\r\ndata.\r\n\r\nAs a fix, we decided to test against specific
metrics attributes\r\n`stats.detection_rules.detection_rule_usage` which
we expect
being\r\nupdated.","sha":"9036b15be0c75e3541738d6d121bc2583affd447"}}]}]
BACKPORT-->

Co-authored-by: Ievgen Sorokopud <ievgen.sorokopud@elastic.co>
This commit is contained in:
Kibana Machine 2023-08-11 04:13:51 -04:00 committed by GitHub
parent 393b4e318b
commit 0d8ff48975
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23