[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@80ae20f382
This commit is contained in:
parent
7b3b2d5f02
commit
02c0ad2aad
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue