Skip to content

Commit 80297f4

Browse files
authored
[CCR Monitoring] Only collect stats for specified indices (#33655)
Backport of #33646 to 6.x. Original message: Follow up to #33617. Relates to #30086. As with all other per-index Monitoring collectors, the `CcrStatsCollector` should only collect stats for the indices the user wants to monitor. This list is controlled by the `xpack.monitoring.collection.indices` setting and defaults to all indices.
1 parent 59100c4 commit 80297f4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/ccr/CcrStatsCollector.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
package org.elasticsearch.xpack.monitoring.collector.ccr;
88

9+
import org.elasticsearch.action.support.IndicesOptions;
910
import org.elasticsearch.client.Client;
1011
import org.elasticsearch.cluster.ClusterState;
1112
import org.elasticsearch.cluster.service.ClusterService;
12-
import org.elasticsearch.common.Strings;
1313
import org.elasticsearch.common.settings.Setting;
1414
import org.elasticsearch.common.settings.Settings;
1515
import org.elasticsearch.common.unit.TimeValue;
@@ -72,7 +72,8 @@ protected Collection<MonitoringDoc> doCollect(
7272
final ClusterState clusterState) throws Exception {
7373
try (ThreadContext.StoredContext ignore = stashWithOrigin(threadContext, MONITORING_ORIGIN)) {
7474
final CcrStatsAction.StatsRequest request = new CcrStatsAction.StatsRequest();
75-
request.setIndices(Strings.EMPTY_ARRAY);
75+
request.setIndices(getCollectionIndices());
76+
request.setIndicesOptions(IndicesOptions.lenientExpandOpen());
7677
final CcrStatsAction.StatsResponses responses = ccrClient.stats(request).actionGet(getCollectionTimeout());
7778

7879
final long timestamp = timestamp();

0 commit comments

Comments
 (0)