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

[Stack Monitoring] update rules queries to support metricbeat 8.0 [fixed PR] #125748

Merged
merged 11 commits into from
Feb 16, 2022

Conversation

jasonrhodes
Copy link
Member

@jasonrhodes jasonrhodes commented Feb 16, 2022

Fixes #125035

Summary

This PR replaces #125315 because I screwed that one up with a bad merge that resulted in tons of commits getting mixed into the PR.

@neptunian's original summary was:

resolves #125035. Fixes queries in Stack Monitoring rules to be compatible with metricbeat 8 mappings. Except for CCR, I tested these on main with metricbeat 8.1.0. CCR i tested with metricbeat 8.1.0 mappings but used my own data as I couldn't get a local CCR setup.

I tested these manually by looking at the response and the data it returned. Ideally we need a proper way to run functional tests on these rule queries.

TODO

Backporting to 8.0.1 notes:

  • createDatasetFilter doesn't exist in 8.0.0 so will need add the metricset.name in a bool should along with type (legacy). no need to add data_stream.dataset term
  • no unit tests for each fetch in 8.0.0
  • esClient.search response change

@jasonrhodes jasonrhodes added bug Fixes for quality problems that affect the customer experience v8.1.0 v8.2.0 v8.0.1 labels Feb 16, 2022
@jasonrhodes jasonrhodes requested a review from a team as a code owner February 16, 2022 03:11
@jasonrhodes jasonrhodes changed the title 125035 fix alerts mb 8.0 [Stack Monitoring] update rules queries to support metricbeat 8.0 [fixed PR] Feb 16, 2022
@jasonrhodes jasonrhodes force-pushed the 125035-fix-alerts-mb-8.0 branch from bb1b054 to dcf4de6 Compare February 16, 2022 03:34
@@ -134,15 +135,20 @@ export async function fetchIndexShardSize(
}
const {
_index: monitoringIndexName,
_source: { index_stats: indexStats },
_source: { index_stats: indexStats, elasticsearch },
Copy link
Contributor

Choose a reason for hiding this comment

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

if you just declare indexStats like this:
const indexStats = topHit._source.index_stats || topHit._source.elasticsearch?.index, I don't think you'd need to make any other changes below this line @klacabane

Copy link
Contributor

@neptunian neptunian Feb 16, 2022

Choose a reason for hiding this comment

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

This will make the 8.0.1 backport a bit more painful in this file as well.

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

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

@jasonrhodes
Copy link
Member Author

Thanks to the amazing new PR cloud deploy tool, I've just verified this PR fixes the SM CPU, Memory (JVM), and Disk Usage alerts in cloud! 🙌

@jasonrhodes jasonrhodes merged commit 7126bc9 into elastic:main Feb 16, 2022
@jasonrhodes jasonrhodes added the auto-backport Deprecated - use backport:version if exact versions are needed label Feb 16, 2022
@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.1 Backport failed because of merge conflicts
8.0 Backport failed because of merge conflicts

You might need to backport the following PRs to 8.0:
- [REVERT THE REVERT] [Monitoring] Cluster state watch to Kibana alerting (#62793)

How to fix

Re-run the backport manually:

node scripts/backport --pr 125748

Questions ?

Please refer to the Backport tool documentation

@jasonrhodes jasonrhodes deleted the 125035-fix-alerts-mb-8.0 branch February 16, 2022 18:11
klacabane pushed a commit to klacabane/kibana that referenced this pull request Feb 16, 2022
…xed PR] (elastic#125748)

* update queries to use metricset.name and fix paths

* fix ccr query

* fix cluster health query paths

* update elasticsearch version mismatch

* update fetchLicense paths

* use ecs properties in fetch_index_shard_size

* Clarified comment about createDatasetFilter

* Re-editing a clarifying comment

* Small comment edit

* Revert "use ecs properties in fetch_index_shard_size"

This reverts commit cdf8b24.

* simplify fetch_index_shard_size document handling

Co-authored-by: neptunian <[email protected]>
Co-authored-by: klacabane <[email protected]>
(cherry picked from commit 7126bc9)

# Conflicts:
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_clusters.ts
klacabane pushed a commit to klacabane/kibana that referenced this pull request Feb 16, 2022
…xed PR] (elastic#125748)

* update queries to use metricset.name and fix paths

* fix ccr query

* fix cluster health query paths

* update elasticsearch version mismatch

* update fetchLicense paths

* use ecs properties in fetch_index_shard_size

* Clarified comment about createDatasetFilter

* Re-editing a clarifying comment

* Small comment edit

* Revert "use ecs properties in fetch_index_shard_size"

This reverts commit cdf8b24.

* simplify fetch_index_shard_size document handling

Co-authored-by: neptunian <[email protected]>
Co-authored-by: klacabane <[email protected]>
(cherry picked from commit 7126bc9)

# Conflicts:
#	x-pack/plugins/monitoring/server/lib/alerts/create_dataset_query_filter.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_ccr_read_exceptions.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_ccr_read_exceptions.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_cluster_health.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_cluster_health.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_clusters.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_clusters.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_cpu_usage_node_stats.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_cpu_usage_node_stats.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_disk_usage_node_stats.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_disk_usage_node_stats.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_elasticsearch_versions.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_elasticsearch_versions.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_index_shard_size.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_index_shard_size.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_kibana_versions.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_kibana_versions.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_licenses.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_licenses.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_logstash_versions.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_logstash_versions.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_memory_usage_node_stats.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_memory_usage_node_stats.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_missing_monitoring_data.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_missing_monitoring_data.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_nodes_from_cluster_stats.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_nodes_from_cluster_stats.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_thread_pool_rejections_stats.ts
klacabane added a commit that referenced this pull request Feb 16, 2022
….0 [fixed PR] (#125748) (#125856)

* [Stack Monitoring] update rules queries to support metricbeat 8.0 [fixed PR] (#125748)

* update queries to use metricset.name and fix paths

* fix ccr query

* fix cluster health query paths

* update elasticsearch version mismatch

* update fetchLicense paths

* use ecs properties in fetch_index_shard_size

* Clarified comment about createDatasetFilter

* Re-editing a clarifying comment

* Small comment edit

* Revert "use ecs properties in fetch_index_shard_size"

This reverts commit cdf8b24.

* simplify fetch_index_shard_size document handling

Co-authored-by: neptunian <[email protected]>
Co-authored-by: klacabane <[email protected]>
(cherry picked from commit 7126bc9)

# Conflicts:
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_clusters.ts

* esClient still returns metadata

Co-authored-by: Jason Rhodes <[email protected]>
klacabane added a commit that referenced this pull request Feb 16, 2022
….0 [fixed PR] (#125748) (#125877)

* [Stack Monitoring] update rules queries to support metricbeat 8.0 [fixed PR] (#125748)

* update queries to use metricset.name and fix paths

* fix ccr query

* fix cluster health query paths

* update elasticsearch version mismatch

* update fetchLicense paths

* use ecs properties in fetch_index_shard_size

* Clarified comment about createDatasetFilter

* Re-editing a clarifying comment

* Small comment edit

* Revert "use ecs properties in fetch_index_shard_size"

This reverts commit cdf8b24.

* simplify fetch_index_shard_size document handling

Co-authored-by: neptunian <[email protected]>
Co-authored-by: klacabane <[email protected]>
(cherry picked from commit 7126bc9)

# Conflicts:
#	x-pack/plugins/monitoring/server/lib/alerts/create_dataset_query_filter.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_ccr_read_exceptions.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_ccr_read_exceptions.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_cluster_health.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_cluster_health.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_clusters.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_clusters.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_cpu_usage_node_stats.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_cpu_usage_node_stats.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_disk_usage_node_stats.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_disk_usage_node_stats.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_elasticsearch_versions.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_elasticsearch_versions.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_index_shard_size.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_index_shard_size.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_kibana_versions.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_kibana_versions.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_licenses.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_licenses.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_logstash_versions.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_logstash_versions.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_memory_usage_node_stats.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_memory_usage_node_stats.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_missing_monitoring_data.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_missing_monitoring_data.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_nodes_from_cluster_stats.test.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_nodes_from_cluster_stats.ts
#	x-pack/plugins/monitoring/server/lib/alerts/fetch_thread_pool_rejections_stats.ts

* import createDatasetFilter

* target correct filter property

Co-authored-by: Jason Rhodes <[email protected]>
@tylersmalley tylersmalley added ci:cloud-deploy Create or update a Cloud deployment and removed ci:deploy-cloud labels Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed bug Fixes for quality problems that affect the customer experience ci:cloud-deploy Create or update a Cloud deployment Feature:Stack Monitoring release_note:fix v8.0.1 v8.1.0 v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Stack Monitoring] Alerts not working with metricbeat in 8.0
7 participants