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

[8.14] Fix the telemetry collection of Logstash with metricbeat monitoring. (#182304) #183331

Merged
merged 1 commit into from
May 13, 2024

Conversation

kibanamachine
Copy link
Contributor

Backport

This will backport the following commits from main to 8.14:

Questions ?

Please refer to the Backport tool documentation

…lastic#182304)

## Summary

Telemetry data collection is broken for Logstash, monitoring with
metricbeat. This PR change covers following issues faced:

**1) Resolve cluster UUID**
- With self monitoring, KB creates `.monitoring-es*` index with mapping
`type` field and defaults to
[`type:cluster_state`](https://github.com/elastic/kibana/blob/main/packages/kbn-apm-synthtrace-client/src/lib/monitoring/cluster_stats.ts#L25)
key-value. It uses [`type:cluster_state` condition when fetching cluster
UUID](https://github.com/elastic/kibana/blob/main/x-pack/plugins/monitoring/server/telemetry_collection/get_cluster_uuids.ts#L48).
- However, with metricbeat, this [_`type` field doesn't exist_ under
mapping](https://github.com/elastic/beats/blob/v8.13.2/metricbeat/module/elasticsearch/_meta/fields.yml)
which metricbeat creates, so cluster UUID will not be resolved as query
is wrong (results empty output).

**2) `type` field mismatch in (especially in _state_) queries, also
collapse field**
- metricbeat sends the _state_ event with `metricset.name:node` and
state fetch query doesn't care about this condition, instead uses
[legacy `type:logstash_state`
condition](https://github.com/elastic/kibana/blob/main/x-pack/plugins/monitoring/server/telemetry_collection/get_logstash_stats.ts#L349)
which is incorrect.
- in the queries, `collapse` field is not correct: it is due to data
shape change from legacy to metricbeat monitoring and queries are
tightly coupled with legacy one
([1](https://github.com/elastic/kibana/blob/main/x-pack/plugins/monitoring/server/telemetry_collection/get_logstash_stats.ts#L355),
[2](https://github.com/elastic/kibana/blob/main/x-pack/plugins/monitoring/server/telemetry_collection/get_logstash_stats.ts#L346),
[3](https://github.com/elastic/kibana/blob/main/x-pack/plugins/monitoring/server/telemetry_collection/get_logstash_stats.ts#L301-L302))
- in the queries, `filter_path` is also not correct: in both [_state_
query](https://github.com/elastic/kibana/blob/main/x-pack/plugins/monitoring/server/telemetry_collection/get_logstash_stats.ts#L332)
and [_stats_
query](https://github.com/elastic/kibana/blob/main/x-pack/plugins/monitoring/server/telemetry_collection/get_logstash_stats.ts#L273)

**3) Logstash state data frequency**
- metricbeat sends _state_ event (_node/stats/pipeline?graph=true) data
once but legacy frequently sends. KB telemetry fetcher [queries against
ES with latest update
period](https://github.com/elastic/kibana/blob/main/x-pack/plugins/monitoring/server/telemetry_collection/get_logstash_stats.ts#L343-L344)
where state data will not be available. It might be a reasonable design
which results network efficiency. If that's the case, we should decide
the expectation
- to still collect: we have to tune the query to collect the state data.
- leave it as an empty assuming state didn't change (personally, I would
not align with this option since collecting once it a data loss risky)

---------

Co-authored-by: Alejandro Fernández Haro <afharo@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 26f6977)
Copy link
Contributor

@mashhurs mashhurs left a comment

Choose a reason for hiding this comment

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

LGTM!

@afharo
Copy link
Member

afharo commented May 13, 2024

Note: this might fail since #183332 is not merged yet. We might need to update this PR after it.

@kibanamachine kibanamachine merged commit fd5d951 into elastic:8.14 May 13, 2024
29 of 30 checks passed
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Unknown metric groups

ESLint disabled line counts

id before after diff
monitoring 18 20 +2

Total ESLint disabled count

id before after diff
monitoring 25 27 +2

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

cc @mashhurs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants