[8.6] [Telemetry] Use GET / to fetch the Cluster UUID (#145536) (#145711)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[Telemetry] Use `GET /` to fetch the Cluster UUID
(#145536)](https://github.com/elastic/kibana/pull/145536)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Alejandro Fernández
Haro","email":"alejandro.haro@elastic.co"},"sourceCommit":{"committedDate":"2022-11-18T10:55:51Z","message":"[Telemetry]
Use `GET /` to fetch the Cluster UUID
(#145536)","sha":"5a2c45ea9e282b88a0ca971a35a865401b7523cd","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","Feature:Telemetry","release_note:skip","backport:all-open","v8.7.0"],"number":145536,"url":"https://github.com/elastic/kibana/pull/145536","mergeCommit":{"message":"[Telemetry]
Use `GET /` to fetch the Cluster UUID
(#145536)","sha":"5a2c45ea9e282b88a0ca971a35a865401b7523cd"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/145536","number":145536,"mergeCommit":{"message":"[Telemetry]
Use `GET /` to fetch the Cluster UUID
(#145536)","sha":"5a2c45ea9e282b88a0ca971a35a865401b7523cd"}}]}]
BACKPORT-->

Co-authored-by: Alejandro Fernández Haro <alejandro.haro@elastic.co>
This commit is contained in:
Kibana Machine 2022-11-18 09:26:17 -05:00 committed by GitHub
parent 9bb90c3465
commit 4f85f53671
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,6 +25,6 @@ export async function getClusterStats(esClient: ElasticsearchClient) {
* @param esClient Scoped Elasticsearch client
*/
export const getClusterUuids: ClusterDetailsGetter = async ({ esClient }) => {
const body = await esClient.cluster.stats({ timeout: TIMEOUT });
const body = await esClient.info({ filter_path: 'cluster_uuid' });
return [{ clusterUuid: body.cluster_uuid }];
};