Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AO] Add metric threshold integration test #157489

Conversation

maryam-saeidi
Copy link
Member

@maryam-saeidi maryam-saeidi commented May 12, 2023

Summary

Closes #157189

This PR adds a metric threshold integration test. This is the first step in adding more test coverage for observability rules.

Steps during the test

  1. Generating fake host data by using a similar implementation as https://github.com/elastic/high-cardinality-cluster
    • Data is generated for the last 15 mins
    • Implementation was simplified only to cover fake hosts and was converted to typescript
  2. Creating an action using an index connector
  3. Creating a metric threshold rule containing step number 2 action
  4. Checking the status of the rule to be active
  5. Checking the triggered action to have the correct parameters
  6. Checking the generated alert to have the correct information
  7. Clean up

How to run locally

  • Run server
node scripts/functional_tests_server --config x-pack/test/api_integration/apis/metrics_ui/config.ts
  • Then run the test
node scripts/functional_tests__runner --include-pack/test/api_integration/apis/metrics_ui/cometric_threshold_rule.ts --config x-pack/test/api_integration/apis/metrics_ui/config.ts

Reference
I created elastic/integrations#6168 to find a better way to generate data and make sure that data matches what metricbeats generates

@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@maryam-saeidi maryam-saeidi self-assigned this May 12, 2023
@maryam-saeidi maryam-saeidi marked this pull request as ready for review May 12, 2023 16:04
@maryam-saeidi maryam-saeidi requested a review from a team as a code owner May 12, 2023 16:04
@maryam-saeidi maryam-saeidi added Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" v8.9.0 labels May 12, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/actionable-observability (Team: Actionable Observability)

@maryam-saeidi maryam-saeidi added the release_note:skip Skip the PR/issue when compiling release notes label May 12, 2023
@maryam-saeidi maryam-saeidi requested a review from a team May 12, 2023 16:04
Copy link
Contributor

@CoenWarmer CoenWarmer left a comment

Choose a reason for hiding this comment

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

LGTM!

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/infra-forge - 9 +9

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
infra 102.2KB 102.3KB +161.0B
Unknown metric groups

API count

id before after diff
@kbn/infra-forge - 9 +9

ESLint disabled line counts

id before after diff
enterpriseSearch 19 21 +2
securitySolution 400 404 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 20 22 +2
securitySolution 480 484 +4
total +6

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @maryam-saeidi

Copy link
Contributor

@mohamedhamed-ahmed mohamedhamed-ahmed left a comment

Choose a reason for hiding this comment

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

LGTM!

@maryam-saeidi maryam-saeidi merged commit fc9f19e into elastic:main May 16, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label May 16, 2023
jasonrhodes pushed a commit that referenced this pull request May 17, 2023
## Summary

Closes #157189

This PR adds a metric threshold integration test. This is the first step
in adding more test coverage for observability rules.

**Steps during the test**
1. Generating fake host data by using a similar implementation as
https://github.com/elastic/high-cardinality-cluster
    - Data is generated for the last 15 mins
- Implementation was simplified only to cover fake hosts and was
converted to typescript
2. Creating an action using an index connector
3. Creating a metric threshold rule containing step number 2 action
4. Checking the status of the rule to be active
5. Checking the triggered action to have the correct parameters
6. Checking the generated alert to have the correct information
7. Clean up

**How to run locally**
- Run server
```
node scripts/functional_tests_server --config x-pack/test/api_integration/apis/metrics_ui/config.ts
```
- Then run the test
```
node scripts/functional_tests__runner --include-pack/test/api_integration/apis/metrics_ui/cometric_threshold_rule.ts --config x-pack/test/api_integration/apis/metrics_ui/config.ts
```

**Reference**
I created elastic/integrations#6168 to find a
better way to generate data and make sure that data matches what
metricbeats generates

---------

Co-authored-by: kibanamachine <[email protected]>
@maryam-saeidi maryam-saeidi deleted the 157189-metric-threshold-integration-test branch June 21, 2023 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team: Actionable Observability - DEPRECATED For Observability Alerting and SLOs use "Team:obs-ux-management", for AIops "Team:obs-knowledge" v8.9.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[AO] Add API integration test for metric threshold
8 participants