Skip to content

Commit

Permalink
[CCR Monitoring] Only collect stats for specified indices (elastic#33646
Browse files Browse the repository at this point in the history
)

Follow up to elastic#33617. Relates to elastic#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 committed Sep 18, 2018
1 parent 1723aa3 commit 5715044
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 5715044

Please sign in to comment.