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

Index cluster.id, node.id, and node.name in elasticsearch/node_stats metricset #9168

Conversation

ycombinator
Copy link
Contributor

@ycombinator ycombinator commented Nov 20, 2018

This PR teaches the elasticsearch/node_stats metricset to index the Elasticsearch cluster_uuid as the module-level cluster.id field, as well as the node ID and node name fields as the metricset-level node.id and node.name fields, respectively.

@ycombinator ycombinator added review Metricbeat Metricbeat needs_backport PR is waiting to be backported to other branches. v7.0.0-alpha1 v6.6.0 labels Nov 20, 2018
Copy link
Member

@ruflin ruflin left a comment

Choose a reason for hiding this comment

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

Worth adding a changelog entry?

@@ -140,6 +141,10 @@ func eventsMapping(r mb.ReporterV2, content []byte) error {
errs = append(errs, event.Error)
}

name, _ := event.MetricSetFields.GetValue("name")
event.ModuleFields.Put("node.name", name.(string))
Copy link
Member

Choose a reason for hiding this comment

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

We should probably check the type conversion here? Also what happens if above returns and error and name does not exist? Will name be nil?

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 didn't add a check here because it will get caught in the schema conversion itself.

Copy link
Member

Choose a reason for hiding this comment

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

I see. Agree that it should not break here but what if someone modifies the other part of the code and does not thing about this part? I normally prefer to be on the safe side.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in bcd8191.

@ycombinator
Copy link
Contributor Author

CI test failure is valid. Fixing...

@ycombinator
Copy link
Contributor Author

@ruflin I added error handling and fixed the CI test failure. Ready for your 👀 again. Thanks!

@ycombinator ycombinator force-pushed the metricbeat-elasticsearch-node-stats-node-id-cluster-id-name branch from bcd8191 to 09e940a Compare November 22, 2018 10:30
release: beta
fields:
- name: indices
type: group
- name: id
Copy link
Member

Choose a reason for hiding this comment

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

I would assume this is now a duplicated field as it's also in node metricset? I general I would recommend to configure "shared" fields on the module level.

@ruflin
Copy link
Member

ruflin commented Nov 26, 2018

jenkins, test this

1 similar comment
@ycombinator
Copy link
Contributor Author

jenkins, test this

@ycombinator
Copy link
Contributor Author

@ruflin Moved node fields to module level. Ready for your 👀 again. Thanks!

release: beta
fields:
- name: indices
- name: stats
Copy link
Member

Choose a reason for hiding this comment

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

Not sure why you introduce the mapping here (was it for the other fields)? In the end both should work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ugh, this change should've been reverted when I moved the node fields to the module level. Sorry about that. Fixing now...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted in b5912d8.

@ycombinator ycombinator force-pushed the metricbeat-elasticsearch-node-stats-node-id-cluster-id-name branch from 614ca9a to b5912d8 Compare November 27, 2018 12:07
@ycombinator ycombinator merged commit 9410148 into elastic:master Nov 27, 2018
ycombinator added a commit to ycombinator/beats that referenced this pull request Nov 27, 2018
…metricset (elastic#9168)

This PR teaches the `elasticsearch/node_stats` metricset to index the Elasticsearch `cluster_uuid` as the module-level `cluster.id` field, as well as the node ID and node `name` fields as the metricset-level `node.id` and `node.name` fields, respectively.

(cherry picked from commit 9410148)
@ycombinator ycombinator removed the needs_backport PR is waiting to be backported to other branches. label Nov 27, 2018
ycombinator added a commit that referenced this pull request Nov 28, 2018
… elasticsearch/node_stats metricset (#9255)

Cherry-pick of PR #9168 to 6.x branch. Original message: 

This PR teaches the `elasticsearch/node_stats` metricset to index the Elasticsearch `cluster_uuid` as the module-level `cluster.id` field, as well as the node ID and node `name` fields as the metricset-level `node.id` and `node.name` fields, respectively.
@ycombinator ycombinator deleted the metricbeat-elasticsearch-node-stats-node-id-cluster-id-name branch December 25, 2019 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants