Watcher: Ensure emit_stacktraces parameter works in watcher stats (elastic/x-pack-elasticsearch#2399)
This parameter ceased to work when Elasticsearch 5 introduced strict parameter handling, because of a missing test. This commit adds the parameter to the rest handler responseParams() and adds a test along with the needed YAML definition. relates elastic/x-pack-elasticsearch#2396 Original commit: elastic/x-pack-elasticsearch@8638df336c
This commit is contained in:
parent
381bb4ed7d
commit
1121a15eb7
|
@ -15,6 +15,7 @@ import org.elasticsearch.xpack.watcher.rest.WatcherRestHandler;
|
|||
import org.elasticsearch.xpack.watcher.transport.actions.stats.WatcherStatsRequest;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||
|
@ -47,4 +48,13 @@ public class RestWatcherStatsAction extends WatcherRestHandler {
|
|||
|
||||
return channel -> client.watcherStats(request, new RestActions.NodesResponseRestListener<>(channel));
|
||||
}
|
||||
|
||||
private static final Set<String> RESPONSE_PARAMS = Collections.singleton("emit_stacktraces");
|
||||
|
||||
@Override
|
||||
protected Set<String> responseParams() {
|
||||
// this parameter is only needed when current watches are supposed to be returned
|
||||
// it's used in the WatchExecutionContext.toXContent() method
|
||||
return RESPONSE_PARAMS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,11 @@
|
|||
"type" : "enum",
|
||||
"options" : ["_all", "queued_watches", "pending_watches"],
|
||||
"description" : "Controls what additional stat metrics should be include in the response"
|
||||
},
|
||||
"emit_stacktraces": {
|
||||
"type" : "boolean",
|
||||
"description" : "Emits stack traces of currently running watches",
|
||||
"required" : false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -4,3 +4,13 @@
|
|||
- do: {xpack.watcher.stats: {}}
|
||||
- match: { "manually_stopped": false }
|
||||
- match: { "stats.0.watcher_state": "started" }
|
||||
|
||||
---
|
||||
"Test watcher stats supports emit_stacktraces parameter":
|
||||
|
||||
- do:
|
||||
xpack.watcher.stats:
|
||||
metric: "all"
|
||||
emit_stacktraces: "true"
|
||||
- match: { "manually_stopped": false }
|
||||
- match: { "stats.0.watcher_state": "started" }
|
||||
|
|
Loading…
Reference in New Issue