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

elasticsearch module - xpack enabled parity #29548

Merged
merged 6 commits into from
Dec 23, 2021

Conversation

klacabane
Copy link
Contributor

@klacabane klacabane commented Dec 20, 2021

Summary

  • Fix drifts from 7.16 in elasticsearch module's documents when xpack.enabled is set.
  • Fix incomplete node property for ml_job and shard metricsets
  • Fix shard's cluster state property path to be consistent with cluster_stats

@klacabane klacabane added Team:Integrations Label for the Integrations team Feature:Stack Monitoring v8.0.0 backport-v8.0.0 Automated backport with mergify v8.1.0 labels Dec 20, 2021
@klacabane klacabane self-assigned this Dec 20, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations (Team:Integrations)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/stack-monitoring (Stack monitoring)

@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 Dec 20, 2021
}
if err := base.Module().UnpackConfig(&config); err != nil {
return nil, err
}

localRecoveryPath := recoveryPath
if config.ActiveOnly {
if !config.XPack && config.ActiveOnly {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that unless something is specifically broken, we shouldn't need to add this check back.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are we fine flipping the ActiveOnly default to false then ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes because the xpack flag will eventually dissapear. But users must still explicitly check to true in the case of active_only.

@@ -81,7 +81,6 @@ func eventsMapping(r mb.ReporterV2, info elasticsearch.Info, content []byte, isX
event.ModuleFields = common.MapStr{}
event.ModuleFields.Put("cluster.name", info.ClusterName)
event.ModuleFields.Put("cluster.id", info.ClusterID)
event.ModuleFields.Put("node.id", info.Name)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem here is that we set the name instead of ID which breaks some href in the UI because we usually redirect with the ID. 7.16 didn't have this property set at all so removing it from now but we should populate the node property correctly.

See https://github.com/elastic/beats/blob/7.16/metricbeat/module/elasticsearch/ml_job/data_xpack.go#L68

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see any reason to remove it. I actually don't remember why I added it but we can always cycle if necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed it because we write a name where the consumer of these documents expect an ID. It currently breaks the stack monitoring UI because we build a link out of this ID to redirect to the node's details page, and the redirection fails since we can't find the node details from its name.
Can we push this and follow up with the appropriate fix that would populate the node.id and name ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Populated the node object by parsing the ml_job response.
The conditional is there because the property is only available for opened jobs

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I meant to not remove it. I forgot the "not" 😅

@elasticmachine
Copy link
Collaborator

elasticmachine commented Dec 20, 2021

💚 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 preview

Expand to view the summary

Build stats

  • Start Time: 2021-12-21T14:25:27.793+0000

  • Duration: 86 min 24 sec

  • Commit: e433ec8

Test stats 🧪

Test Results
Failed 0
Passed 9394
Skipped 2432
Total 11826

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@@ -81,7 +81,6 @@ func eventsMapping(r mb.ReporterV2, info elasticsearch.Info, content []byte, isX
event.ModuleFields = common.MapStr{}
event.ModuleFields.Put("cluster.name", info.ClusterName)
event.ModuleFields.Put("cluster.id", info.ClusterID)
event.ModuleFields.Put("node.id", info.Name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I meant to not remove it. I forgot the "not" 😅

@@ -72,7 +72,7 @@ func eventsMapping(r mb.ReporterV2, content []byte, isXpack bool) error {
ModuleFields: common.MapStr{},
}

event.ModuleFields.Put("cluster.state.id", stateData.StateID)
event.ModuleFields.Put("cluster.stats.state.state_uuid", stateData.StateID)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is breaking change at the moment. Instead of removing the old field, add a new one duplicating the value of the current one.

At the same time, we need to add this new field in the corresponding fields.yml, this one: https://github.com/elastic/beats/blob/master/metricbeat/module/elasticsearch/cluster_stats/_meta/fields.yml

The run a mage fmt update at the root of metricbeat folder and you'll see a bunch of files changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't this field already defined or am I looking at wrong place ?

Copy link
Contributor

Choose a reason for hiding this comment

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

It is already defined, yes. But that just mean "index it" maybe it was a leftover and we finally don't write into that field in the module.

Copy link
Contributor

@sayden sayden left a comment

Choose a reason for hiding this comment

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

LGTM

@klacabane klacabane merged commit 0bfa0a1 into elastic:master Dec 23, 2021
mergify bot pushed a commit that referenced this pull request Dec 23, 2021
* elasticsearch module - xpack enabled parity

* flip ActiveOnly default

* add ml_job's node

* lint

* update shard cluster's state path

* add back state.id to prevent breaking changes

(cherry picked from commit 0bfa0a1)
klacabane added a commit that referenced this pull request Dec 23, 2021
* elasticsearch module - xpack enabled parity

* flip ActiveOnly default

* add ml_job's node

* lint

* update shard cluster's state path

* add back state.id to prevent breaking changes

(cherry picked from commit 0bfa0a1)

Co-authored-by: Kevin Lacabane <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.0.0 Automated backport with mergify Feature:Stack Monitoring Team:Integrations Label for the Integrations team v8.0.0 v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants