Stats api: fix serialization issue
Renamed pending watches left overs to queued watches Original commit: elastic/x-pack-elasticsearch@c2bcdf547c
This commit is contained in:
parent
0890001470
commit
47247dc46a
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<WatcherStatsResponse>(restChannel) {
|
||||
|
|
|
@ -69,7 +69,7 @@ public class TransportWatcherStatsAction extends WatcherTransportAction<WatcherS
|
|||
if (request.includeCurrentWatches()) {
|
||||
statsResponse.setSnapshots(executionService.currentExecutions());
|
||||
}
|
||||
if (request.includePendingWatches()) {
|
||||
if (request.includeQueuedWatches()) {
|
||||
statsResponse.setQueuedWatches(executionService.queuedWatches());
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import java.io.IOException;
|
|||
public class WatcherStatsRequest extends MasterNodeOperationRequest<WatcherStatsRequest> {
|
||||
|
||||
private boolean includeCurrentWatches;
|
||||
private boolean includePendingWatches;
|
||||
private boolean includeQueuedWatches;
|
||||
|
||||
public WatcherStatsRequest() {
|
||||
}
|
||||
|
@ -31,12 +31,12 @@ public class WatcherStatsRequest extends MasterNodeOperationRequest<WatcherStats
|
|||
this.includeCurrentWatches = currentWatches;
|
||||
}
|
||||
|
||||
public boolean includePendingWatches() {
|
||||
return includePendingWatches;
|
||||
public boolean includeQueuedWatches() {
|
||||
return includeQueuedWatches;
|
||||
}
|
||||
|
||||
public void includePendingWatches(boolean includePendingWatches) {
|
||||
this.includePendingWatches = includePendingWatches;
|
||||
public void includeQueuedWatches(boolean includeQueuedWatches) {
|
||||
this.includeQueuedWatches = includeQueuedWatches;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -48,14 +48,14 @@ public class WatcherStatsRequest extends MasterNodeOperationRequest<WatcherStats
|
|||
public void readFrom(StreamInput in) throws IOException {
|
||||
super.readFrom(in);
|
||||
includeCurrentWatches = in.readBoolean();
|
||||
includePendingWatches = in.readBoolean();
|
||||
includeQueuedWatches = in.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
super.writeTo(out);
|
||||
out.writeBoolean(includeCurrentWatches);
|
||||
out.writeBoolean(includeCurrentWatches);
|
||||
out.writeBoolean(includeQueuedWatches);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,8 +23,8 @@ public class WatcherStatsRequestBuilder extends MasterNodeOperationRequestBuilde
|
|||
request().includeCurrentWatches(includeCurrentWatches);
|
||||
return this;
|
||||
}
|
||||
public WatcherStatsRequestBuilder setIncludePendingWatches(boolean includePendingWatches) {
|
||||
request().includePendingWatches(includePendingWatches);
|
||||
public WatcherStatsRequestBuilder setIncludeQueuedWatches(boolean includeQueuedWatches) {
|
||||
request().includeQueuedWatches(includeQueuedWatches);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import static org.hamcrest.Matchers.*;
|
|||
/**
|
||||
*/
|
||||
@LuceneTestCase.Slow
|
||||
@ElasticsearchIntegrationTest.ClusterScope(scope = TEST, numClientNodes = 0, transportClientRatio = 0, randomDynamicTemplates = false, numDataNodes = 1)
|
||||
@ElasticsearchIntegrationTest.ClusterScope(scope = TEST, numClientNodes = 0, transportClientRatio = 0, randomDynamicTemplates = false, numDataNodes = 2)
|
||||
public class SlowWatchStatsTests extends AbstractWatcherIntegrationTests {
|
||||
|
||||
@Override
|
||||
|
@ -88,7 +88,7 @@ public class SlowWatchStatsTests extends AbstractWatcherIntegrationTests {
|
|||
assertBusy(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
WatcherStatsResponse response = watcherClient().prepareWatcherStats().setIncludePendingWatches(true).get();
|
||||
WatcherStatsResponse response = watcherClient().prepareWatcherStats().setIncludeQueuedWatches(true).get();
|
||||
assertThat(response.getWatcherState(), equalTo(WatcherState.STARTED));
|
||||
assertThat(response.getWatchesCount(), equalTo(5l));
|
||||
assertThat(response.getSnapshots(), nullValue());
|
||||
|
|
Loading…
Reference in New Issue