Skip to content

Conversation

@williamrandolph
Copy link
Contributor

This PR refactors the NodesStatsRequest object towards pluggability. It has the same basic structure as a similar refactor of the NodesInfoRequest object.

Now that the NodesStatsRequest class uses a set of strings for its internal serialization, we need to update the class's interface so that we no longer use hard-coded getters and setters, but rather methods that add strings directly. For example, the old way of adding "os" metrics to a request would be to call request.os(true). The new way of doing this is to call request.addMetric("os").

For the time being, the canonical list of metrics is an enum in NodesStatsRequest. This will eventually be replaced with something pluggable.

Note that the NodesStatsRequestBuilder class also needs to be refactored, but I'm leaving that for a later PR in order to keep the diff manageable.

Relates #52975 (meta issue)
Relates #53410 (parallel refactor of Nodes Info)
Relates #53235 (previous work on NodesStatsRequest)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (:Core/Infra/Plugins)

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

A couple minor questions/suggestions

@williamrandolph williamrandolph requested a review from rjernst March 24, 2020 18:42
Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

LGTM

@bpintea bpintea added v7.8.0 and removed v7.7.0 labels Mar 25, 2020
@williamrandolph williamrandolph merged commit 7bc130b into elastic:master Mar 26, 2020
@williamrandolph williamrandolph deleted the nodes-stats-request-interface-refactor branch March 26, 2020 18:40
williamrandolph added a commit that referenced this pull request Mar 26, 2020
The NodesStatsRequest class uses a set of strings for its internal
serialization. This commit updates the class's interface so that we
no longer use hard-coded getters and setters, but rather
methods that add strings directly. For example, the old way of
adding "os" metrics to a request would be to call request.os(true).
The new way of doing this is to call request.addMetric("os").

For the time being, the canonical list of metrics is an enum in
NodesStatsRequest. This will eventually be replaced with something
pluggable.
@williamrandolph
Copy link
Contributor Author

Backport to 7.x: #54223
Small bit of this backported to 7.7: #54193

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.

5 participants