From 47247dc46abc470d24e1927d3fa6b1a4bb249b35 Mon Sep 17 00:00:00 2001 From: Martijn van Groningen Date: Sun, 31 May 2015 13:13:16 +0200 Subject: [PATCH] Stats api: fix serialization issue Renamed pending watches left overs to queued watches Original commit: elastic/x-pack-elasticsearch@c2bcdf547c148d780d90f7c1a5b6441224d41722 --- .../watcher/execution/WatchExecutionSnapshot.java | 6 ++---- .../rest/action/RestWatcherStatsAction.java | 4 ++-- .../actions/stats/TransportWatcherStatsAction.java | 2 +- .../actions/stats/WatcherStatsRequest.java | 14 +++++++------- .../actions/stats/WatcherStatsRequestBuilder.java | 4 ++-- .../test/integration/SlowWatchStatsTests.java | 4 ++-- 6 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/main/java/org/elasticsearch/watcher/execution/WatchExecutionSnapshot.java b/src/main/java/org/elasticsearch/watcher/execution/WatchExecutionSnapshot.java index 9d6d3b11e9e..88cb043630c 100644 --- a/src/main/java/org/elasticsearch/watcher/execution/WatchExecutionSnapshot.java +++ b/src/main/java/org/elasticsearch/watcher/execution/WatchExecutionSnapshot.java @@ -14,8 +14,6 @@ import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.watcher.actions.ActionWrapper; import org.elasticsearch.watcher.actions.ExecutableActions; -import org.elasticsearch.watcher.execution.ExecutionPhase; -import org.elasticsearch.watcher.execution.ExecutionService; import java.io.IOException; @@ -88,7 +86,7 @@ public class WatchExecutionSnapshot implements Streamable, ToXContent { for (int i = 0; i < size; i++) { String declaringClass = in.readString(); String methodName = in.readString(); - String fileName = in.readString(); + String fileName = in.readOptionalString(); int lineNumber = in.readInt(); executionStackTrace[i] = new StackTraceElement(declaringClass, methodName, fileName, lineNumber); } @@ -105,7 +103,7 @@ public class WatchExecutionSnapshot implements Streamable, ToXContent { for (StackTraceElement element : executionStackTrace) { out.writeString(element.getClassName()); out.writeString(element.getMethodName()); - out.writeString(element.getFileName()); + out.writeOptionalString(element.getFileName()); out.writeInt(element.getLineNumber()); } } diff --git a/src/main/java/org/elasticsearch/watcher/rest/action/RestWatcherStatsAction.java b/src/main/java/org/elasticsearch/watcher/rest/action/RestWatcherStatsAction.java index e541f830c72..49879be6635 100644 --- a/src/main/java/org/elasticsearch/watcher/rest/action/RestWatcherStatsAction.java +++ b/src/main/java/org/elasticsearch/watcher/rest/action/RestWatcherStatsAction.java @@ -38,10 +38,10 @@ public class RestWatcherStatsAction extends WatcherRestHandler { WatcherStatsRequest request = new WatcherStatsRequest(); if (metrics.contains("_all")) { request.includeCurrentWatches(true); - request.includePendingWatches(true); + request.includeQueuedWatches(true); } else { request.includeCurrentWatches(metrics.contains("queued_watches")); - request.includePendingWatches(metrics.contains("pending_watches")); + request.includeQueuedWatches(metrics.contains("pending_watches")); } client.watcherStats(request, new RestBuilderListener(restChannel) { diff --git a/src/main/java/org/elasticsearch/watcher/transport/actions/stats/TransportWatcherStatsAction.java b/src/main/java/org/elasticsearch/watcher/transport/actions/stats/TransportWatcherStatsAction.java index 829b9f61f3e..6c0b8550769 100644 --- a/src/main/java/org/elasticsearch/watcher/transport/actions/stats/TransportWatcherStatsAction.java +++ b/src/main/java/org/elasticsearch/watcher/transport/actions/stats/TransportWatcherStatsAction.java @@ -69,7 +69,7 @@ public class TransportWatcherStatsAction extends WatcherTransportAction { private boolean includeCurrentWatches; - private boolean includePendingWatches; + private boolean includeQueuedWatches; public WatcherStatsRequest() { } @@ -31,12 +31,12 @@ public class WatcherStatsRequest extends MasterNodeOperationRequest