kibana/x-pack/plugins/cloud/index.js
Ahmad Bamieh a5537ee3b4
[6.7] [Telemetry] collect xpack.cloud details (#31180) (#31704)
* [Telemetry] collect xpack.cloud details (#31180)

* collect xpack.cloud details

* add elasticsearch cluster uuid

* remove cloud ID from telemetry stats

* remove esUUID from telemtry stats

* add stack_stats.kibana.plugins.cloud.isCloudEnabled
2019-02-24 15:09:17 +02:00

46 lines
1.2 KiB
JavaScript

/*
* 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.
*/
import { getCloudUsageCollector } from './get_cloud_usage_collector';
export const cloud = kibana => {
return new kibana.Plugin({
id: 'cloud',
configPrefix: 'xpack.cloud',
require: ['kibana', 'elasticsearch', 'xpack_main'],
uiExports: {
injectDefaultVars(server, options) {
return {
isCloudEnabled: !!options.id,
cloudId: options.id
};
},
},
config(Joi) {
return Joi.object({
enabled: Joi.boolean().default(true),
id: Joi.string(),
apm: Joi.object({
url: Joi.string(),
secret_token: Joi.string(),
ui: Joi.object({
url: Joi.string(),
}).default(),
}).default(),
}).default();
},
init(server) {
const config = server.config().get(`xpack.cloud`);
server.expose('config', {
isCloudEnabled: !!config.id
});
server.usage.collectorSet.register(getCloudUsageCollector(server));
}
});
};