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
Cluster stats should not render empty http/transport types #23735
Cluster stats should not render empty http/transport types #23735
Conversation
37514c6
to
ee83445
Compare
9bca46c
to
67cac31
Compare
This commit changes the ClusterStatsNodes.NetworkTypes so that is does not print out empty field names when no Transport or HTTP type is defined: ``` { "network_types": { ... "http_types": { "": 2 } } } ``` is now rendered as: ``` { "network_types": { ... "http_types": { } } } ```
67cac31
to
442ed82
Compare
@@ -560,12 +571,16 @@ private NetworkTypes(final List<NodeInfo> nodeInfos) { | |||
public XContentBuilder toXContent(final XContentBuilder builder, final Params params) throws IOException { | |||
builder.startObject("transport_types"); | |||
for (final Map.Entry<String, AtomicInteger> entry : transportTypes.entrySet()) { | |||
builder.field(entry.getKey(), entry.getValue().get()); | |||
if (Strings.hasText(entry.getKey())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the check be done here, or should such an element never get added to the map at the first place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM in general, left one comment regarding the check and if we might want to not populate the list in the first place
Thanks @spinscale ! |
This commit changes the ClusterStatsNodes.NetworkTypes so that is does not print out empty field names when no Transport or HTTP type is defined: ``` { "network_types": { ... "http_types": { "": 2 } } } ``` is now rendered as: ``` { "network_types": { ... "http_types": { } } } ```
This commit changes the ClusterStatsNodes.NetworkTypes so that is does not print out empty field names when no Transport or HTTP type is defined: ``` { "network_types": { ... "http_types": { "": 2 } } } ``` is now rendered as: ``` { "network_types": { ... "http_types": { } } } ```
This commit changes the ClusterStatsNodes.NetworkTypes so that is does not print out empty field names when no Transport or HTTP type is defined: ``` { "network_types": { ... "http_types": { "": 2 } } } ``` is now rendered as: ``` { "network_types": { ... "http_types": { } } } ```
* master: Fix language in some docs CONSOLEify lang-analyzer docs Stricter parsing of remote node attribute Fix cross-cluster remote node gateway attributes FieldCapabilitiesRequest should implements Replaceable since it accepts index patterns Cleanup: Remove unused FieldMappers class (elastic#23851) Fix FieldCapabilities compilation in Eclipse (elastic#23855) Add extra debugging to reindex cancel tests Cluster stats should not render empty http/transport types (elastic#23735)
This commit changes
ClusterStatsNodes.NetworkTypes
so that is doesnot print out empty field names when no Transport or HTTP type is defined:
is now rendered as:
This should almost never happen because
transport-netty4
is shipped by default, but we can have integration tests that use mocked transport plugins without registering HTTP transport types.