[Monitoring] Reduce NodeStats Collection to required Data (elastic/x-pack-elasticsearch#1240)
This changes from collecting every index statistic to only what we actually want. This should help to reduce the performance impact of the lookup.
Original commit: elastic/x-pack-elasticsearch@80ae20f382020831a5eff6ccd15efe9909532ca9
@@ -31,6 +31,16 @@ import java.util.Collections;
*/
public class NodeStatsCollector extends Collector {
+ private static final CommonStatsFlags FLAGS =
+ new CommonStatsFlags(CommonStatsFlags.Flag.Docs,
+ CommonStatsFlags.Flag.FieldData,
+ CommonStatsFlags.Flag.Store,
+ CommonStatsFlags.Flag.Indexing,
+ CommonStatsFlags.Flag.QueryCache,
+ CommonStatsFlags.Flag.RequestCache,
+ CommonStatsFlags.Flag.Search,
+ CommonStatsFlags.Flag.Segments);
+
private final Client client;
public NodeStatsCollector(Settings settings, ClusterService clusterService,
@@ -43,7 +53,7 @@ public class NodeStatsCollector extends Collector {
@Override
protected Collection<MonitoringDoc> doCollect() throws Exception {
NodesStatsRequest request = new NodesStatsRequest("_local");
- request.indices(CommonStatsFlags.ALL);
+ request.indices(FLAGS);
request.os(true);
request.jvm(true);
request.process(true);
@@ -67,4 +77,5 @@ public class NodeStatsCollector extends Collector {
return Collections.singletonList(nodeStatsDoc);
}
+
}
