diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/Ccr.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/Ccr.java index 7caf144d533..1c1cade2484 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/Ccr.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/Ccr.java @@ -53,7 +53,7 @@ import org.elasticsearch.xpack.core.ccr.action.PutAutoFollowPatternAction; import org.elasticsearch.xpack.ccr.action.ShardChangesAction; import org.elasticsearch.xpack.ccr.action.ShardFollowTask; import org.elasticsearch.xpack.ccr.action.ShardFollowTasksExecutor; -import org.elasticsearch.xpack.ccr.action.TransportCcrStatsAction; +import org.elasticsearch.xpack.ccr.action.TransportFollowStatsAction; import org.elasticsearch.xpack.ccr.action.TransportPutFollowAction; import org.elasticsearch.xpack.ccr.action.TransportDeleteAutoFollowPatternAction; import org.elasticsearch.xpack.ccr.action.TransportResumeFollowAction; @@ -62,7 +62,7 @@ import org.elasticsearch.xpack.ccr.action.TransportPauseFollowAction; import org.elasticsearch.xpack.ccr.action.bulk.BulkShardOperationsAction; import org.elasticsearch.xpack.ccr.action.bulk.TransportBulkShardOperationsAction; import org.elasticsearch.xpack.ccr.index.engine.FollowingEngineFactory; -import org.elasticsearch.xpack.ccr.rest.RestCcrStatsAction; +import org.elasticsearch.xpack.ccr.rest.RestFollowStatsAction; import org.elasticsearch.xpack.ccr.rest.RestPutFollowAction; import org.elasticsearch.xpack.ccr.rest.RestDeleteAutoFollowPatternAction; import org.elasticsearch.xpack.ccr.rest.RestResumeFollowAction; @@ -70,7 +70,7 @@ import org.elasticsearch.xpack.ccr.rest.RestPutAutoFollowPatternAction; import org.elasticsearch.xpack.ccr.rest.RestPauseFollowAction; import org.elasticsearch.xpack.core.XPackPlugin; import org.elasticsearch.xpack.core.ccr.ShardFollowNodeTaskStatus; -import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction; +import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction; import org.elasticsearch.xpack.core.ccr.action.PutFollowAction; import org.elasticsearch.xpack.core.ccr.action.ResumeFollowAction; import org.elasticsearch.xpack.core.ccr.action.PauseFollowAction; @@ -161,7 +161,7 @@ public class Ccr extends Plugin implements ActionPlugin, PersistentTaskPlugin, E new ActionHandler<>(BulkShardOperationsAction.INSTANCE, TransportBulkShardOperationsAction.class), new ActionHandler<>(ShardChangesAction.INSTANCE, ShardChangesAction.TransportAction.class), // stats action - new ActionHandler<>(CcrStatsAction.INSTANCE, TransportCcrStatsAction.class), + new ActionHandler<>(FollowStatsAction.INSTANCE, TransportFollowStatsAction.class), new ActionHandler<>(AutoFollowStatsAction.INSTANCE, TransportAutoFollowStatsAction.class), // follow actions new ActionHandler<>(PutFollowAction.INSTANCE, TransportPutFollowAction.class), @@ -184,7 +184,7 @@ public class Ccr extends Plugin implements ActionPlugin, PersistentTaskPlugin, E return Arrays.asList( // stats API - new RestCcrStatsAction(settings, restController), + new RestFollowStatsAction(settings, restController), new RestAutoFollowStatsAction(settings, restController), // follow APIs new RestPutFollowAction(settings, restController), diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/TransportCcrStatsAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/TransportFollowStatsAction.java similarity index 70% rename from x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/TransportCcrStatsAction.java rename to x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/TransportFollowStatsAction.java index 394b42789d1..bce471d05e8 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/TransportCcrStatsAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/TransportFollowStatsAction.java @@ -22,7 +22,7 @@ import org.elasticsearch.tasks.Task; import org.elasticsearch.transport.TransportService; import org.elasticsearch.xpack.ccr.Ccr; import org.elasticsearch.xpack.ccr.CcrLicenseChecker; -import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction; +import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction; import java.io.IOException; import java.util.Arrays; @@ -32,16 +32,16 @@ import java.util.Objects; import java.util.Set; import java.util.function.Consumer; -public class TransportCcrStatsAction extends TransportTasksAction< +public class TransportFollowStatsAction extends TransportTasksAction< ShardFollowNodeTask, - CcrStatsAction.StatsRequest, - CcrStatsAction.StatsResponses, CcrStatsAction.StatsResponse> { + FollowStatsAction.StatsRequest, + FollowStatsAction.StatsResponses, FollowStatsAction.StatsResponse> { private final IndexNameExpressionResolver resolver; private final CcrLicenseChecker ccrLicenseChecker; @Inject - public TransportCcrStatsAction( + public TransportFollowStatsAction( final Settings settings, final ClusterService clusterService, final TransportService transportService, @@ -50,12 +50,12 @@ public class TransportCcrStatsAction extends TransportTasksAction< final CcrLicenseChecker ccrLicenseChecker) { super( settings, - CcrStatsAction.NAME, + FollowStatsAction.NAME, clusterService, transportService, actionFilters, - CcrStatsAction.StatsRequest::new, - CcrStatsAction.StatsResponses::new, + FollowStatsAction.StatsRequest::new, + FollowStatsAction.StatsResponses::new, Ccr.CCR_THREAD_POOL_NAME); this.resolver = Objects.requireNonNull(resolver); this.ccrLicenseChecker = Objects.requireNonNull(ccrLicenseChecker); @@ -64,8 +64,8 @@ public class TransportCcrStatsAction extends TransportTasksAction< @Override protected void doExecute( final Task task, - final CcrStatsAction.StatsRequest request, - final ActionListener listener) { + final FollowStatsAction.StatsRequest request, + final ActionListener listener) { if (ccrLicenseChecker.isCcrAllowed() == false) { listener.onFailure(LicenseUtils.newComplianceException("ccr")); return; @@ -74,21 +74,21 @@ public class TransportCcrStatsAction extends TransportTasksAction< } @Override - protected CcrStatsAction.StatsResponses newResponse( - final CcrStatsAction.StatsRequest request, - final List statsRespons, + protected FollowStatsAction.StatsResponses newResponse( + final FollowStatsAction.StatsRequest request, + final List statsRespons, final List taskOperationFailures, final List failedNodeExceptions) { - return new CcrStatsAction.StatsResponses(taskOperationFailures, failedNodeExceptions, statsRespons); + return new FollowStatsAction.StatsResponses(taskOperationFailures, failedNodeExceptions, statsRespons); } @Override - protected CcrStatsAction.StatsResponse readTaskResponse(final StreamInput in) throws IOException { - return new CcrStatsAction.StatsResponse(in); + protected FollowStatsAction.StatsResponse readTaskResponse(final StreamInput in) throws IOException { + return new FollowStatsAction.StatsResponse(in); } @Override - protected void processTasks(final CcrStatsAction.StatsRequest request, final Consumer operation) { + protected void processTasks(final FollowStatsAction.StatsRequest request, final Consumer operation) { final ClusterState state = clusterService.state(); final Set concreteIndices = new HashSet<>(Arrays.asList(resolver.concreteIndexNames(state, request))); for (final Task task : taskManager.getTasks().values()) { @@ -103,10 +103,10 @@ public class TransportCcrStatsAction extends TransportTasksAction< @Override protected void taskOperation( - final CcrStatsAction.StatsRequest request, + final FollowStatsAction.StatsRequest request, final ShardFollowNodeTask task, - final ActionListener listener) { - listener.onResponse(new CcrStatsAction.StatsResponse(task.getStatus())); + final ActionListener listener) { + listener.onResponse(new FollowStatsAction.StatsResponse(task.getStatus())); } } diff --git a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestCcrStatsAction.java b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowStatsAction.java similarity index 73% rename from x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestCcrStatsAction.java rename to x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowStatsAction.java index 976d8ba2074..25572894af3 100644 --- a/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestCcrStatsAction.java +++ b/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/rest/RestFollowStatsAction.java @@ -13,13 +13,13 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; -import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction; +import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction; import java.io.IOException; -public class RestCcrStatsAction extends BaseRestHandler { +public class RestFollowStatsAction extends BaseRestHandler { - public RestCcrStatsAction(final Settings settings, final RestController controller) { + public RestFollowStatsAction(final Settings settings, final RestController controller) { super(settings); controller.registerHandler(RestRequest.Method.GET, "/_ccr/stats", this); controller.registerHandler(RestRequest.Method.GET, "/{index}/_ccr/stats", this); @@ -32,9 +32,9 @@ public class RestCcrStatsAction extends BaseRestHandler { @Override protected RestChannelConsumer prepareRequest(final RestRequest restRequest, final NodeClient client) throws IOException { - final CcrStatsAction.StatsRequest request = new CcrStatsAction.StatsRequest(); + final FollowStatsAction.StatsRequest request = new FollowStatsAction.StatsRequest(); request.setIndices(Strings.splitStringByCommaToArray(restRequest.param("index"))); - return channel -> client.execute(CcrStatsAction.INSTANCE, request, new RestToXContentListener<>(channel)); + return channel -> client.execute(FollowStatsAction.INSTANCE, request, new RestToXContentListener<>(channel)); } } diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrLicenseIT.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrLicenseIT.java index 7e5ae092408..eb0b29912b2 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrLicenseIT.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrLicenseIT.java @@ -22,7 +22,7 @@ import org.elasticsearch.plugins.Plugin; import org.elasticsearch.test.ESSingleNodeTestCase; import org.elasticsearch.test.MockLogAppender; import org.elasticsearch.xpack.ccr.action.AutoFollowCoordinator; -import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction; +import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction; import org.elasticsearch.xpack.core.ccr.action.PutFollowAction; import org.elasticsearch.xpack.core.ccr.action.ResumeFollowAction; import org.elasticsearch.xpack.core.ccr.AutoFollowMetadata; @@ -88,21 +88,24 @@ public class CcrLicenseIT extends ESSingleNodeTestCase { latch.await(); } - public void testThatCcrStatsAreUnavailableWithNonCompliantLicense() throws InterruptedException { + public void testThatFollowStatsAreUnavailableWithNonCompliantLicense() throws InterruptedException { final CountDownLatch latch = new CountDownLatch(1); - client().execute(CcrStatsAction.INSTANCE, new CcrStatsAction.StatsRequest(), new ActionListener() { - @Override - public void onResponse(final CcrStatsAction.StatsResponses statsResponses) { - latch.countDown(); - fail(); - } + client().execute( + FollowStatsAction.INSTANCE, + new FollowStatsAction.StatsRequest(), + new ActionListener() { + @Override + public void onResponse(final FollowStatsAction.StatsResponses statsResponses) { + latch.countDown(); + fail(); + } - @Override - public void onFailure(final Exception e) { - assertNonCompliantLicense(e); - latch.countDown(); - } - }); + @Override + public void onFailure(final Exception e) { + assertNonCompliantLicense(e); + latch.countDown(); + } + }); latch.await(); } diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/ShardChangesIT.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/ShardChangesIT.java index f4d098f41ab..8ed3fc53340 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/ShardChangesIT.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/ShardChangesIT.java @@ -59,9 +59,9 @@ import org.elasticsearch.xpack.ccr.action.ShardFollowTask; import org.elasticsearch.xpack.ccr.index.engine.FollowingEngine; import org.elasticsearch.xpack.core.XPackSettings; import org.elasticsearch.xpack.core.ccr.ShardFollowNodeTaskStatus; -import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction; -import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction.StatsRequest; -import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction.StatsResponses; +import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction; +import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction.StatsRequest; +import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction.StatsResponses; import org.elasticsearch.xpack.core.ccr.action.PutFollowAction; import org.elasticsearch.xpack.core.ccr.action.ResumeFollowAction; import org.elasticsearch.xpack.core.ccr.action.PauseFollowAction; @@ -570,7 +570,7 @@ public class ShardChangesIT extends ESIntegTestCase { client().admin().indices().close(new CloseIndexRequest("index1")).actionGet(); assertBusy(() -> { - StatsResponses response = client().execute(CcrStatsAction.INSTANCE, new StatsRequest()).actionGet(); + StatsResponses response = client().execute(FollowStatsAction.INSTANCE, new StatsRequest()).actionGet(); assertThat(response.getNodeFailures(), empty()); assertThat(response.getTaskFailures(), empty()); assertThat(response.getStatsResponses(), hasSize(1)); @@ -605,7 +605,7 @@ public class ShardChangesIT extends ESIntegTestCase { client().admin().indices().close(new CloseIndexRequest("index2")).actionGet(); client().prepareIndex("index1", "doc", "2").setSource("{}", XContentType.JSON).get(); assertBusy(() -> { - StatsResponses response = client().execute(CcrStatsAction.INSTANCE, new StatsRequest()).actionGet(); + StatsResponses response = client().execute(FollowStatsAction.INSTANCE, new StatsRequest()).actionGet(); assertThat(response.getNodeFailures(), empty()); assertThat(response.getTaskFailures(), empty()); assertThat(response.getStatsResponses(), hasSize(1)); diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/StatsRequestTests.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/StatsRequestTests.java index ea1e8874914..97c2b26a4a7 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/StatsRequestTests.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/StatsRequestTests.java @@ -6,18 +6,18 @@ package org.elasticsearch.xpack.ccr.action; import org.elasticsearch.test.AbstractStreamableTestCase; -import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction; +import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction; -public class StatsRequestTests extends AbstractStreamableTestCase { +public class StatsRequestTests extends AbstractStreamableTestCase { @Override - protected CcrStatsAction.StatsRequest createBlankInstance() { - return new CcrStatsAction.StatsRequest(); + protected FollowStatsAction.StatsRequest createBlankInstance() { + return new FollowStatsAction.StatsRequest(); } @Override - protected CcrStatsAction.StatsRequest createTestInstance() { - CcrStatsAction.StatsRequest statsRequest = new CcrStatsAction.StatsRequest(); + protected FollowStatsAction.StatsRequest createTestInstance() { + FollowStatsAction.StatsRequest statsRequest = new FollowStatsAction.StatsRequest(); if (randomBoolean()) { statsRequest.setIndices(generateRandomStringArray(8, 4, false)); } diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/StatsResponsesTests.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/StatsResponsesTests.java index b79f8db1923..1de949b850b 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/StatsResponsesTests.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/action/StatsResponsesTests.java @@ -7,23 +7,23 @@ package org.elasticsearch.xpack.ccr.action; import org.elasticsearch.test.AbstractStreamableTestCase; import org.elasticsearch.xpack.core.ccr.ShardFollowNodeTaskStatus; -import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction; +import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction; import java.util.ArrayList; import java.util.Collections; import java.util.List; -public class StatsResponsesTests extends AbstractStreamableTestCase { +public class StatsResponsesTests extends AbstractStreamableTestCase { @Override - protected CcrStatsAction.StatsResponses createBlankInstance() { - return new CcrStatsAction.StatsResponses(); + protected FollowStatsAction.StatsResponses createBlankInstance() { + return new FollowStatsAction.StatsResponses(); } @Override - protected CcrStatsAction.StatsResponses createTestInstance() { + protected FollowStatsAction.StatsResponses createTestInstance() { int numResponses = randomIntBetween(0, 8); - List responses = new ArrayList<>(numResponses); + List responses = new ArrayList<>(numResponses); for (int i = 0; i < numResponses; i++) { ShardFollowNodeTaskStatus status = new ShardFollowNodeTaskStatus( randomAlphaOfLength(4), @@ -49,8 +49,8 @@ public class StatsResponsesTests extends AbstractStreamableTestCase statuses = mockStatuses(); + final List statuses = mockStatuses(); @SuppressWarnings("unchecked") - final ActionFuture future = (ActionFuture)mock(ActionFuture.class); - final CcrStatsAction.StatsResponses responses = new CcrStatsAction.StatsResponses(emptyList(), emptyList(), statuses); + final ActionFuture future = + (ActionFuture)mock(ActionFuture.class); + final FollowStatsAction.StatsResponses responses = new FollowStatsAction.StatsResponses(emptyList(), emptyList(), statuses); - final CcrStatsAction.StatsRequest request = new CcrStatsAction.StatsRequest(); + final FollowStatsAction.StatsRequest request = new FollowStatsAction.StatsRequest(); request.setIndices(Strings.EMPTY_ARRAY); when(client.stats(statsRequestEq(request))).thenReturn(future); when(future.actionGet(timeout)).thenReturn(responses); @@ -81,26 +83,26 @@ public class CcrStatsCollectorTests extends AbstractCcrCollectorTestCase { int index = 0; for (final Iterator it = documents.iterator(); it.hasNext(); index++) { - final CcrStatsMonitoringDoc document = (CcrStatsMonitoringDoc)it.next(); - final CcrStatsAction.StatsResponse status = statuses.get(index); + final FollowStatsMonitoringDoc document = (FollowStatsMonitoringDoc)it.next(); + final FollowStatsAction.StatsResponse status = statuses.get(index); assertThat(document.getCluster(), is(clusterUuid)); assertThat(document.getTimestamp(), greaterThan(0L)); assertThat(document.getIntervalMillis(), equalTo(interval)); assertThat(document.getNode(), equalTo(node)); assertThat(document.getSystem(), is(MonitoredSystem.ES)); - assertThat(document.getType(), is(CcrStatsMonitoringDoc.TYPE)); + assertThat(document.getType(), is(FollowStatsMonitoringDoc.TYPE)); assertThat(document.getId(), nullValue()); assertThat(document.status(), is(status.status())); } } - private List mockStatuses() { + private List mockStatuses() { final int count = randomIntBetween(1, 8); - final List statuses = new ArrayList<>(count); + final List statuses = new ArrayList<>(count); for (int i = 0; i < count; ++i) { - CcrStatsAction.StatsResponse statsResponse = mock(CcrStatsAction.StatsResponse.class); + FollowStatsAction.StatsResponse statsResponse = mock(FollowStatsAction.StatsResponse.class); ShardFollowNodeTaskStatus status = mock(ShardFollowNodeTaskStatus.class); when(statsResponse.status()).thenReturn(status); statuses.add(statsResponse); @@ -109,21 +111,21 @@ public class CcrStatsCollectorTests extends AbstractCcrCollectorTestCase { return statuses; } - private static CcrStatsAction.StatsRequest statsRequestEq(CcrStatsAction.StatsRequest expected) { - return argThat(new StatsRequestMatches(expected)); + private static FollowStatsAction.StatsRequest statsRequestEq(FollowStatsAction.StatsRequest expected) { + return argThat(new FollowStatsRequest(expected)); } - private static class StatsRequestMatches extends ArgumentMatcher { + private static class FollowStatsRequest extends ArgumentMatcher { - private final CcrStatsAction.StatsRequest expected; + private final FollowStatsAction.StatsRequest expected; - private StatsRequestMatches(CcrStatsAction.StatsRequest expected) { + private FollowStatsRequest(FollowStatsAction.StatsRequest expected) { this.expected = expected; } @Override public boolean matches(Object o) { - CcrStatsAction.StatsRequest actual = (CcrStatsAction.StatsRequest) o; + FollowStatsAction.StatsRequest actual = (FollowStatsAction.StatsRequest) o; return Arrays.equals(expected.indices(), actual.indices()); } } diff --git a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/monitoring/collector/ccr/CcrStatsMonitoringDocTests.java b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/monitoring/collector/ccr/FollowStatsMonitoringDocTests.java similarity index 93% rename from x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/monitoring/collector/ccr/CcrStatsMonitoringDocTests.java rename to x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/monitoring/collector/ccr/FollowStatsMonitoringDocTests.java index 808a1e20159..58af900a5ad 100644 --- a/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/monitoring/collector/ccr/CcrStatsMonitoringDocTests.java +++ b/x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/monitoring/collector/ccr/FollowStatsMonitoringDocTests.java @@ -39,7 +39,7 @@ import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.nullValue; import static org.mockito.Mockito.mock; -public class CcrStatsMonitoringDocTests extends BaseMonitoringDocTestCase { +public class FollowStatsMonitoringDocTests extends BaseMonitoringDocTestCase { private ShardFollowNodeTaskStatus status; @@ -52,12 +52,12 @@ public class CcrStatsMonitoringDocTests extends BaseMonitoringDocTestCase new CcrStatsMonitoringDoc(cluster, timestamp, interval, node, null)); + expectThrows(NullPointerException.class, () -> new FollowStatsMonitoringDoc(cluster, timestamp, interval, node, null)); assertThat(e, hasToString(containsString("status"))); } @Override - protected CcrStatsMonitoringDoc createMonitoringDoc( + protected FollowStatsMonitoringDoc createMonitoringDoc( final String cluster, final long timestamp, final long interval, @@ -65,13 +65,13 @@ public class CcrStatsMonitoringDocTests extends BaseMonitoringDocTestCase template = XContentHelper.convertToMap(XContentType.JSON.xContent(), MonitoringTemplateUtils.loadTemplate("es"), false); - Map ccrStatsMapping = (Map) XContentMapValues.extractValue("mappings.doc.properties.ccr_stats.properties", template); + Map followStatsMapping = (Map) XContentMapValues.extractValue("mappings.doc.properties.ccr_stats.properties", template); - assertThat(serializedStatus.size(), equalTo(ccrStatsMapping.size())); + assertThat(serializedStatus.size(), equalTo(followStatsMapping.size())); for (Map.Entry entry : serializedStatus.entrySet()) { String fieldName = entry.getKey(); - Map fieldMapping = (Map) ccrStatsMapping.get(fieldName); + Map fieldMapping = (Map) followStatsMapping.get(fieldName); assertThat(fieldMapping, notNullValue()); Object fieldValue = entry.getValue(); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/CcrStatsAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/FollowStatsAction.java similarity index 93% rename from x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/CcrStatsAction.java rename to x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/FollowStatsAction.java index a69ecbf7cdf..d7df03f1e8c 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/CcrStatsAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/action/FollowStatsAction.java @@ -30,13 +30,13 @@ import java.util.Map; import java.util.Objects; import java.util.TreeMap; -public class CcrStatsAction extends Action { +public class FollowStatsAction extends Action { public static final String NAME = "cluster:monitor/ccr/stats"; - public static final CcrStatsAction INSTANCE = new CcrStatsAction(); + public static final FollowStatsAction INSTANCE = new FollowStatsAction(); - private CcrStatsAction() { + private FollowStatsAction() { super(NAME); } @@ -140,8 +140,8 @@ public class CcrStatsAction extends Action { * This is a limitation of the current tasks API. When the transport action is executed, the tasks API invokes this match method * to find the tasks on which to execute the task-level operation (see TransportTasksAction#nodeOperation and * TransportTasksAction#processTasks). If we do the matching here, then we can not match index patterns. Therefore, we override - * TransportTasksAction#processTasks (see TransportCcrStatsAction#processTasks) and do the matching there. We should never see - * this method invoked and since we can not support matching a task on the basis of the request here, we throw that this + * TransportTasksAction#processTasks (see TransportFollowStatsAction#processTasks) and do the matching there. We should never + * see this method invoked and since we can not support matching a task on the basis of the request here, we throw that this * operation is unsupported. */ throw new UnsupportedOperationException(); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/client/CcrClient.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/client/CcrClient.java index 1dab97599df..3d5be565c1e 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/client/CcrClient.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ccr/client/CcrClient.java @@ -12,7 +12,7 @@ import org.elasticsearch.action.support.PlainActionFuture; import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.ElasticsearchClient; import org.elasticsearch.xpack.core.ccr.action.AutoFollowStatsAction; -import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction; +import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction; import org.elasticsearch.xpack.core.ccr.action.PutFollowAction; import org.elasticsearch.xpack.core.ccr.action.DeleteAutoFollowPatternAction; import org.elasticsearch.xpack.core.ccr.action.ResumeFollowAction; @@ -54,14 +54,14 @@ public class CcrClient { } public void stats( - final CcrStatsAction.StatsRequest request, - final ActionListener listener) { - client.execute(CcrStatsAction.INSTANCE, request, listener); + final FollowStatsAction.StatsRequest request, + final ActionListener listener) { + client.execute(FollowStatsAction.INSTANCE, request, listener); } - public ActionFuture stats(final CcrStatsAction.StatsRequest request) { - final PlainActionFuture listener = PlainActionFuture.newFuture(); - client.execute(CcrStatsAction.INSTANCE, request, listener); + public ActionFuture stats(final FollowStatsAction.StatsRequest request) { + final PlainActionFuture listener = PlainActionFuture.newFuture(); + client.execute(FollowStatsAction.INSTANCE, request, listener); return listener; } diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/Monitoring.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/Monitoring.java index d18286a9db5..31f403918fa 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/Monitoring.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/Monitoring.java @@ -40,7 +40,7 @@ import org.elasticsearch.xpack.monitoring.action.TransportMonitoringBulkAction; import org.elasticsearch.xpack.monitoring.cleaner.CleanerService; import org.elasticsearch.xpack.monitoring.collector.Collector; import org.elasticsearch.xpack.monitoring.collector.ccr.CcrAutoFollowStatsCollector; -import org.elasticsearch.xpack.monitoring.collector.ccr.CcrStatsCollector; +import org.elasticsearch.xpack.monitoring.collector.ccr.FollowStatsCollector; import org.elasticsearch.xpack.monitoring.collector.cluster.ClusterStatsCollector; import org.elasticsearch.xpack.monitoring.collector.indices.IndexRecoveryCollector; import org.elasticsearch.xpack.monitoring.collector.indices.IndexStatsCollector; @@ -144,7 +144,7 @@ public class Monitoring extends Plugin implements ActionPlugin { collectors.add(new NodeStatsCollector(settings, clusterService, getLicenseState(), client)); collectors.add(new IndexRecoveryCollector(settings, clusterService, getLicenseState(), client)); collectors.add(new JobStatsCollector(settings, clusterService, getLicenseState(), client)); - collectors.add(new CcrStatsCollector(settings, clusterService, getLicenseState(), client)); + collectors.add(new FollowStatsCollector(settings, clusterService, getLicenseState(), client)); collectors.add(new CcrAutoFollowStatsCollector(settings, clusterService, getLicenseState(), client)); final MonitoringService monitoringService = new MonitoringService(settings, clusterService, threadPool, collectors, exporters); @@ -184,7 +184,7 @@ public class Monitoring extends Plugin implements ActionPlugin { settings.add(IndexRecoveryCollector.INDEX_RECOVERY_ACTIVE_ONLY); settings.add(IndexStatsCollector.INDEX_STATS_TIMEOUT); settings.add(JobStatsCollector.JOB_STATS_TIMEOUT); - settings.add(CcrStatsCollector.CCR_STATS_TIMEOUT); + settings.add(FollowStatsCollector.CCR_STATS_TIMEOUT); settings.add(CcrAutoFollowStatsCollector.CCR_AUTO_FOLLOW_STATS_TIMEOUT); settings.add(NodeStatsCollector.NODE_STATS_TIMEOUT); settings.addAll(Exporters.getSettings()); diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/ccr/AbstractCcrCollector.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/ccr/AbstractCcrCollector.java index f6b124d6df5..e3db3d33667 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/ccr/AbstractCcrCollector.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/ccr/AbstractCcrCollector.java @@ -22,7 +22,7 @@ import java.util.Collection; import static org.elasticsearch.xpack.core.ClientHelper.MONITORING_ORIGIN; import static org.elasticsearch.xpack.core.ClientHelper.stashWithOrigin; -import static org.elasticsearch.xpack.monitoring.collector.ccr.CcrStatsMonitoringDoc.TYPE; +import static org.elasticsearch.xpack.monitoring.collector.ccr.FollowStatsMonitoringDoc.TYPE; public abstract class AbstractCcrCollector extends Collector { diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/ccr/CcrStatsCollector.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/ccr/FollowStatsCollector.java similarity index 79% rename from x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/ccr/CcrStatsCollector.java rename to x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/ccr/FollowStatsCollector.java index e9f3d09ef43..3255032e785 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/ccr/CcrStatsCollector.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/ccr/FollowStatsCollector.java @@ -14,18 +14,18 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.license.XPackLicenseState; import org.elasticsearch.xpack.core.XPackClient; -import org.elasticsearch.xpack.core.ccr.action.CcrStatsAction; +import org.elasticsearch.xpack.core.ccr.action.FollowStatsAction; import org.elasticsearch.xpack.core.ccr.client.CcrClient; import org.elasticsearch.xpack.core.monitoring.exporter.MonitoringDoc; import java.util.Collection; import java.util.stream.Collectors; -public final class CcrStatsCollector extends AbstractCcrCollector { +public final class FollowStatsCollector extends AbstractCcrCollector { public static final Setting CCR_STATS_TIMEOUT = collectionTimeoutSetting("ccr.stats.timeout"); - public CcrStatsCollector( + public FollowStatsCollector( final Settings settings, final ClusterService clusterService, final XPackLicenseState licenseState, @@ -34,7 +34,7 @@ public final class CcrStatsCollector extends AbstractCcrCollector { client.threadPool().getThreadContext()); } - CcrStatsCollector( + FollowStatsCollector( final Settings settings, final ClusterService clusterService, final XPackLicenseState licenseState, @@ -51,14 +51,14 @@ public final class CcrStatsCollector extends AbstractCcrCollector { MonitoringDoc.Node node) throws Exception { - final CcrStatsAction.StatsRequest request = new CcrStatsAction.StatsRequest(); + final FollowStatsAction.StatsRequest request = new FollowStatsAction.StatsRequest(); request.setIndices(getCollectionIndices()); - final CcrStatsAction.StatsResponses responses = ccrClient.stats(request).actionGet(getCollectionTimeout()); + final FollowStatsAction.StatsResponses responses = ccrClient.stats(request).actionGet(getCollectionTimeout()); return responses .getStatsResponses() .stream() - .map(stats -> new CcrStatsMonitoringDoc(clusterUuid, timestamp, interval, node, stats.status())) + .map(stats -> new FollowStatsMonitoringDoc(clusterUuid, timestamp, interval, node, stats.status())) .collect(Collectors.toList()); } diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/ccr/CcrStatsMonitoringDoc.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/ccr/FollowStatsMonitoringDoc.java similarity index 93% rename from x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/ccr/CcrStatsMonitoringDoc.java rename to x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/ccr/FollowStatsMonitoringDoc.java index 45c6a8607d4..53ceb48ad3d 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/ccr/CcrStatsMonitoringDoc.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/collector/ccr/FollowStatsMonitoringDoc.java @@ -14,7 +14,7 @@ import org.elasticsearch.xpack.core.monitoring.exporter.MonitoringDoc; import java.io.IOException; import java.util.Objects; -public class CcrStatsMonitoringDoc extends MonitoringDoc { +public class FollowStatsMonitoringDoc extends MonitoringDoc { public static final String TYPE = "ccr_stats"; @@ -24,7 +24,7 @@ public class CcrStatsMonitoringDoc extends MonitoringDoc { return status; } - public CcrStatsMonitoringDoc( + public FollowStatsMonitoringDoc( final String cluster, final long timestamp, final long intervalMillis,