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

Make kibana/stats metricset work for Stack Monitoring without xpack.enabled flag #21496

Conversation

sayden
Copy link
Contributor

@sayden sayden commented Oct 2, 2020

Ready for testing. Check data.json and settings_data.json for a look of how the events look like now.

@sayden sayden added Metricbeat Metricbeat Feature:Stack Monitoring Team:Services (Deprecated) Label for the former Integrations-Services team labels Oct 2, 2020
@sayden sayden self-assigned this Oct 2, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/stack-monitoring (Stack monitoring)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-services (Team:Services)

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Oct 2, 2020
@botelastic
Copy link

botelastic bot commented Oct 2, 2020

This pull request doesn't have a Team:<team> label.

@sayden sayden changed the base branch from master to feature-stack-monitoring-mb-ecs October 2, 2020 18:54
@elasticmachine
Copy link
Collaborator

elasticmachine commented Oct 2, 2020

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: Pull request #21496 updated

  • Start Time: 2020-12-10T18:51:53.856+0000

  • Duration: 56 min 15 sec

Test stats 🧪

Test Results
Failed 0
Passed 2265
Skipped 520
Total 2785

Steps errors 2

Expand to view the steps failures

Terraform Apply on x-pack/metricbeat/module/aws
  • Took 0 min 15 sec . View more details on here
Terraform Apply on x-pack/metricbeat/module/aws
  • Took 0 min 15 sec . View more details on here

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 2265
Skipped 520
Total 2785

@chrisronline
Copy link
Contributor

chrisronline commented Oct 23, 2020

I'm seeing this error when running MB:

2020-10-23T14:10:10.317-0400 ERROR [publisher_pipeline_output] pipeline/output.go:154 Failed to connect to backoff(elasticsearch(https://localhost:9200)): Connection marked as failed because the onConnect callback failed: error loading template: could not load template. Elasticsearch returned: couldn't load template: 400 Bad Request: {"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Invalid [path] value [kibana.stats.usage] for field alias [kibana.stats.usage.name]: an alias must refer to an existing field in the mappings."}],"type":"mapper_parsing_exception","reason":"Invalid [path] value [kibana.stats.usage] for field alias [kibana.stats.usage.name]: an alias must refer to an existing field in the mappings."},"status":400}. Response body: {"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Invalid [path] value [kibana.stats.usage] for field alias [kibana.stats.usage.name]: an alias must refer to an existing field in the mappings."}],"type":"mapper_parsing_exception","reason":"Invalid [path] value [kibana.stats.usage] for field alias [kibana.stats.usage.name]: an alias must refer to an existing field in the mappings."},"status":400}.

@elasticmachine
Copy link
Collaborator

🐛 Flaky test report

❕ There are test failures but not known flaky tests.

Expand to view the summary

Test stats 🧪

Test Results
Failed 4
Passed 2194
Skipped 469
Total 2667

Genuine test errors 4

💔 There are test failures but not known flaky tests, most likely a genuine test failure.

    * **Name**: `Build&Test / metricbeat-goIntegTest / TestXPackEnabled – kibana`
    * **Name**: `Build&Test / metricbeat-goIntegTest / TestFetch – status`
    * **Name**: `Build&Test / x-pack/metricbeat-build / test_migration – x-pack.metricbeat.tests.system.test_xpack_base.Test`
    * **Name**: `Build&Test / x-pack/metricbeat-build / test_template – x-pack.metricbeat.tests.system.test_xpack_base.Test`

@chrisronline
Copy link
Contributor

I'm still getting the same error:

2020-11-09T12:59:34.256-0500 ERROR [publisher_pipeline_output] pipeline/output.go:154 Failed to connect to backoff(elasticsearch(https://localhost:9200)): Connection marked as failed because the onConnect callback failed: error loading template: could not load template. Elasticsearch returned: couldn't load template: 400 Bad Request: {"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Invalid [path] value [kibana.stats.usage] for field alias [kibana.stats.usage.name]: an alias must refer to an existing field in the mappings."}],"type":"mapper_parsing_exception","reason":"Invalid [path] value [kibana.stats.usage] for field alias [kibana.stats.usage.name]: an alias must refer to an existing field in the mappings."},"status":400}. Response body: {"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Invalid [path] value [kibana.stats.usage] for field alias [kibana.stats.usage.name]: an alias must refer to an existing field in the mappings."}],"type":"mapper_parsing_exception","reason":"Invalid [path] value [kibana.stats.usage] for field alias [kibana.stats.usage.name]: an alias must refer to an existing field in the mappings."},"status":400

}
},
"snapshot": false,
"status": "green"
"status": "green",
"usage": {
Copy link
Contributor

Choose a reason for hiding this comment

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

With the recent changes in #22732, I don't think we even need to collect usage any more. WDYT @chrisronline - safe to omit usage collection in this PR here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes! Please remove it

if m.XPackEnabled {
m.fetchSettings(r, now)
if err = m.fetchSettings(r); err != nil {
return errors.Wrap(err, "error trying to get settings data from Kibana")
Copy link
Contributor

Choose a reason for hiding this comment

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

So previously (before this PR), this metricset would behave as follows:

  • if xpack.enabled: true was set, it would produce two events in each Fetch iteration, indexed into .monitoring-kibana-*, one with type: kibana_stats and one with type: kibana_settings.
  • if xpack.enabled: false was set, it would produce one event in each Fetch iteration, indexed into metricbeat-*, corresponding to type: kibana_stats` (but not actually including that field).

With the changes in this PR, it seems like we would always be producing two events per Fetch iteration: one corresponding to type: kibana_stats and one corresponding to type: kibana_settings. I wonder if now it makes sense to keep the kibana/stats metricset for just the former and create a new metricset, kibana/settings, for just the latter? It would be more in line with how other Metricbeat modules work. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

Feel free to perform this split of metricsets in a follow up PR to the feature branch. For now, if you want to merge the PR with the current implementation, that's fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll do it in a different PR because I have seen that it requires that I change quite a lot of thing in the base module. I mean, I have to change them anyways but I discovered it now.

Copy link
Contributor

@ycombinator ycombinator left a comment

Choose a reason for hiding this comment

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

I've left a couple of comments/questions on this PR. Besides those, this PR LGTM. So I'm approving it now.

Feel free to address the comments before you merge this PR OR merge it as-is now and address the comments in the feature branch later, as you prefer.

@sayden sayden merged commit 283ef2a into elastic:feature-stack-monitoring-mb-ecs Dec 16, 2020
@sayden sayden deleted the feature/mb/kibana/stats_xpack_flag branch August 25, 2022 12:54
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Stack Monitoring Metricbeat Metricbeat Team:Services (Deprecated) Label for the former Integrations-Services team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants