Conversation
This commit adds the _xpack/usage api to the high level rest client. Currently in the transport api, the usage data is exposed in a limited fashion, at most giving one level of helper methods for the inner keys of data, but then exposing thos subobjects as maps of objects. Rather than making parsers for every set of usage data from each feature, this PR exposes the entire set of usage data as a map of maps.
|
Pinging @elastic/es-core-infra |
| Map<String, Object> monitoringUsage = usages.get("monitoring"); | ||
| assertThat(monitoringUsage.get("available"), is(true)); | ||
| assertThat(monitoringUsage.get("enabled"), is(true)); | ||
| assertThat(monitoringUsage.get("collection_enabled"), is(false)); |
| ==== Execution | ||
|
|
||
| Detailed information about the usage of features from {xpack} can be | ||
| retrieved using the `xpackUsage()` method: |
There was a problem hiding this comment.
The name isn't quite right here. I suspect the name in xpackInfo isn't right either now that I see this. I bet I didn't catch that in the rename....
There was a problem hiding this comment.
I think the name is correct. What do you think it should be?
There was a problem hiding this comment.
Ah ic, xpackUsage is the helper method in RequestConverters.
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License; | ||
| * you may not use this file except in compliance with the Elastic License. | ||
| * Licensed to Elasticsearch under one or more contributor |
There was a problem hiding this comment.
I think this'll cause the build to fail.
| import org.elasticsearch.action.ActionRequestValidationException; | ||
|
|
||
| /** A dummy request object solely for the purpose of boilerplate. */ | ||
| public class XPackUsageRequest extends ActionRequest { |
There was a problem hiding this comment.
It looks to me like there is a master_node_timeout that you can set on the request. Maybe we move the one in x-pack into the protocol and use it instead?
| import java.util.Map; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| public class XPackUsageResponse { |
There was a problem hiding this comment.
May as well stick javadoc on it. It'll be mostly ceremonial but it might help someone who hasn't figured out the naming convention yet.
|
@nik9000 I think I have addressed all your comments. |
nik9000
left a comment
There was a problem hiding this comment.
I left two tiny things. LGTM otherwise.
| return request; | ||
| } | ||
|
|
||
| @SuppressWarnings("unused") |
|
|
||
| @SuppressWarnings("unused") | ||
| static Request xpackUsage(XPackUsageRequest request) { | ||
| return new Request(HttpGet.METHOD_NAME, "/_xpack/usage"); |
There was a problem hiding this comment.
Can you add the master timeout?
This commit adds the _xpack/usage api to the high level rest client. Currently in the transport api, the usage data is exposed in a limited fashion, at most giving one level of helper methods for the inner keys of data, but then exposing thos subobjects as maps of objects. Rather than making parsers for every set of usage data from each feature, this PR exposes the entire set of usage data as a map of maps.
* es/6.x: Use correct formatting for links (#29460) Revert "Adds a new auto-interval date histogram (#28993)" Revert "fix typo" fix typo Adds a new auto-interval date histogram (#28993) [Rollup] Replace RollupIT with a ESRestTestCase version (#31977) [Rollup] Fix duplicate field names in test (#32075) [Tests] Fix failure due to changes exception message (#32036) [Test] Mute MlJobIT#testDeleteJobAfterMissingAliases Replace Ingest ScriptContext with Custom Interface (#32003) (#32060) Cleanup Duplication in `PainlessScriptEngine` (#31991) (#32061) HLRC: Add xpack usage api (#31975) Clean Up Snapshot Create Rest API (#31779)
This commit adds the _xpack/usage api to the high level rest client.
Currently in the transport api, the usage data is exposed in a limited
fashion, at most giving one level of helper methods for the inner keys
of data, but then exposing thos subobjects as maps of objects. Rather
than making parsers for every set of usage data from each feature, this
PR exposes the entire set of usage data as a map of maps.