diff --git a/server/src/main/java/org/opensearch/action/admin/cluster/node/info/NodeInfo.java b/server/src/main/java/org/opensearch/action/admin/cluster/node/info/NodeInfo.java index 544fd1fb6aaf4..2841382d64e53 100644 --- a/server/src/main/java/org/opensearch/action/admin/cluster/node/info/NodeInfo.java +++ b/server/src/main/java/org/opensearch/action/admin/cluster/node/info/NodeInfo.java @@ -43,6 +43,7 @@ import org.opensearch.core.common.unit.ByteSizeValue; import org.opensearch.core.service.ReportingService; import org.opensearch.http.HttpInfo; +import org.opensearch.grpc.GrpcInfo; import org.opensearch.ingest.IngestInfo; import org.opensearch.monitor.jvm.JvmInfo; import org.opensearch.monitor.os.OsInfo; @@ -97,6 +98,7 @@ public NodeInfo(StreamInput in) throws IOException { addInfoIfNonNull(ThreadPoolInfo.class, in.readOptionalWriteable(ThreadPoolInfo::new)); addInfoIfNonNull(TransportInfo.class, in.readOptionalWriteable(TransportInfo::new)); addInfoIfNonNull(HttpInfo.class, in.readOptionalWriteable(HttpInfo::new)); + addInfoIfNonNull(GrpcInfo.class, in.readOptionalWriteable(GrpcInfo::new)); addInfoIfNonNull(PluginsAndModules.class, in.readOptionalWriteable(PluginsAndModules::new)); addInfoIfNonNull(IngestInfo.class, in.readOptionalWriteable(IngestInfo::new)); addInfoIfNonNull(AggregationInfo.class, in.readOptionalWriteable(AggregationInfo::new)); @@ -116,6 +118,7 @@ public NodeInfo( @Nullable ThreadPoolInfo threadPool, @Nullable TransportInfo transport, @Nullable HttpInfo http, + @Nullable GrpcInfo grpc, @Nullable PluginsAndModules plugins, @Nullable IngestInfo ingest, @Nullable AggregationInfo aggsInfo, @@ -132,6 +135,7 @@ public NodeInfo( addInfoIfNonNull(ThreadPoolInfo.class, threadPool); addInfoIfNonNull(TransportInfo.class, transport); addInfoIfNonNull(HttpInfo.class, http); + addInfoIfNonNull(GrpcInfo.class, grpc); addInfoIfNonNull(PluginsAndModules.class, plugins); addInfoIfNonNull(IngestInfo.class, ingest); addInfoIfNonNull(AggregationInfo.class, aggsInfo); @@ -221,6 +225,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeOptionalWriteable(getInfo(ThreadPoolInfo.class)); out.writeOptionalWriteable(getInfo(TransportInfo.class)); out.writeOptionalWriteable(getInfo(HttpInfo.class)); + out.writeOptionalWriteable(getInfo(GrpcInfo.class)); out.writeOptionalWriteable(getInfo(PluginsAndModules.class)); out.writeOptionalWriteable(getInfo(IngestInfo.class)); out.writeOptionalWriteable(getInfo(AggregationInfo.class)); @@ -254,6 +259,7 @@ private Builder(Version version, Build build, DiscoveryNode node) { private ThreadPoolInfo threadPool; private TransportInfo transport; private HttpInfo http; + private GrpcInfo grpc; private PluginsAndModules plugins; private IngestInfo ingest; private AggregationInfo aggsInfo; @@ -295,6 +301,11 @@ public Builder setHttp(HttpInfo http) { return this; } + public Builder setGrpc(GrpcInfo grpc) { + this.grpc = grpc; + return this; + } + public Builder setPlugins(PluginsAndModules plugins) { this.plugins = plugins; return this; @@ -332,6 +343,7 @@ public NodeInfo build() { threadPool, transport, http, + grpc, plugins, ingest, aggsInfo, diff --git a/server/src/main/java/org/opensearch/action/admin/cluster/node/info/NodesInfoRequest.java b/server/src/main/java/org/opensearch/action/admin/cluster/node/info/NodesInfoRequest.java index 26b53e8db642f..2d40f56f36a36 100644 --- a/server/src/main/java/org/opensearch/action/admin/cluster/node/info/NodesInfoRequest.java +++ b/server/src/main/java/org/opensearch/action/admin/cluster/node/info/NodesInfoRequest.java @@ -178,6 +178,7 @@ public enum Metric { THREAD_POOL("thread_pool"), TRANSPORT("transport"), HTTP("http"), + GRPC("grpc"), PLUGINS("plugins"), INGEST("ingest"), AGGREGATIONS("aggregations"), diff --git a/server/src/main/java/org/opensearch/action/admin/cluster/node/info/NodesInfoResponse.java b/server/src/main/java/org/opensearch/action/admin/cluster/node/info/NodesInfoResponse.java index 7ddd70185e8ad..30e8226acd58c 100644 --- a/server/src/main/java/org/opensearch/action/admin/cluster/node/info/NodesInfoResponse.java +++ b/server/src/main/java/org/opensearch/action/admin/cluster/node/info/NodesInfoResponse.java @@ -43,6 +43,7 @@ import org.opensearch.core.common.io.stream.StreamOutput; import org.opensearch.core.xcontent.ToXContentFragment; import org.opensearch.core.xcontent.XContentBuilder; +import org.opensearch.grpc.GrpcInfo; import org.opensearch.http.HttpInfo; import org.opensearch.ingest.IngestInfo; import org.opensearch.monitor.jvm.JvmInfo; @@ -140,6 +141,9 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws if (nodeInfo.getInfo(HttpInfo.class) != null) { nodeInfo.getInfo(HttpInfo.class).toXContent(builder, params); } + if (nodeInfo.getInfo(GrpcInfo.class) != null) { + nodeInfo.getInfo(GrpcInfo.class).toXContent(builder, params); + } if (nodeInfo.getInfo(PluginsAndModules.class) != null) { nodeInfo.getInfo(PluginsAndModules.class).toXContent(builder, params); } diff --git a/server/src/main/java/org/opensearch/action/admin/cluster/node/info/TransportNodesInfoAction.java b/server/src/main/java/org/opensearch/action/admin/cluster/node/info/TransportNodesInfoAction.java index dda54cce334ec..bab11cb55fed2 100644 --- a/server/src/main/java/org/opensearch/action/admin/cluster/node/info/TransportNodesInfoAction.java +++ b/server/src/main/java/org/opensearch/action/admin/cluster/node/info/TransportNodesInfoAction.java @@ -114,6 +114,7 @@ protected NodeInfo nodeOperation(NodeInfoRequest nodeRequest) { metrics.contains(NodesInfoRequest.Metric.THREAD_POOL.metricName()), metrics.contains(NodesInfoRequest.Metric.TRANSPORT.metricName()), metrics.contains(NodesInfoRequest.Metric.HTTP.metricName()), + metrics.contains(NodesInfoRequest.Metric.GRPC.metricName()), metrics.contains(NodesInfoRequest.Metric.PLUGINS.metricName()), metrics.contains(NodesInfoRequest.Metric.INGEST.metricName()), metrics.contains(NodesInfoRequest.Metric.AGGREGATIONS.metricName()), diff --git a/server/src/main/java/org/opensearch/action/admin/cluster/stats/TransportClusterStatsAction.java b/server/src/main/java/org/opensearch/action/admin/cluster/stats/TransportClusterStatsAction.java index 3f49fa6f26d8a..17c32e0fcd31f 100644 --- a/server/src/main/java/org/opensearch/action/admin/cluster/stats/TransportClusterStatsAction.java +++ b/server/src/main/java/org/opensearch/action/admin/cluster/stats/TransportClusterStatsAction.java @@ -169,7 +169,7 @@ protected ClusterStatsNodeResponse newNodeResponse(StreamInput in) throws IOExce @Override protected ClusterStatsNodeResponse nodeOperation(ClusterStatsNodeRequest nodeRequest) { - NodeInfo nodeInfo = nodeService.info(true, true, false, true, false, true, false, true, false, false, false, false); + NodeInfo nodeInfo = nodeService.info(true, true, false, true, false, true, false, false, true, false, false, false, false); NodeStats nodeStats = nodeService.stats( CommonStatsFlags.NONE, isMetricRequired(Metric.OS, nodeRequest.request), diff --git a/server/src/main/java/org/opensearch/node/NodeService.java b/server/src/main/java/org/opensearch/node/NodeService.java index 81c050a7c7835..a893ada6eddbc 100644 --- a/server/src/main/java/org/opensearch/node/NodeService.java +++ b/server/src/main/java/org/opensearch/node/NodeService.java @@ -173,6 +173,7 @@ public NodeInfo info( boolean threadPool, boolean transport, boolean http, + boolean grpc, boolean plugin, boolean ingest, boolean aggs, @@ -201,6 +202,9 @@ public NodeInfo info( if (http && httpServerTransport != null) { builder.setHttp(httpServerTransport.info()); } + if (grpc && grpcServerTransport != null) { + builder.setGrpc(grpcServerTransport.info()); + } if (plugin && pluginService != null) { builder.setPlugins(pluginService.info()); }