Skip to content

Commit

Permalink
[CCR Monitoring] Only collect stats for specified indices (#33655)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ycombinator authored Sep 18, 2018
1 parent 59100c4 commit 80297f4
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

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

import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.settings.Setting;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
Expand Down Expand Up @@ -72,7 +72,8 @@ protected Collection<MonitoringDoc> doCollect(
final ClusterState clusterState) throws Exception {
try (ThreadContext.StoredContext ignore = stashWithOrigin(threadContext, MONITORING_ORIGIN)) {
final CcrStatsAction.StatsRequest request = new CcrStatsAction.StatsRequest();
request.setIndices(Strings.EMPTY_ARRAY);
request.setIndices(getCollectionIndices());
request.setIndicesOptions(IndicesOptions.lenientExpandOpen());
final CcrStatsAction.StatsResponses responses = ccrClient.stats(request).actionGet(getCollectionTimeout());

final long timestamp = timestamp();
Expand Down

0 comments on commit 80297f4

Please sign in to comment.