[Monitoring] Change all configs to monitoring.*
(#54919)
* Initial config renaming - not working * Tweak config key names and move to core_deprecations * Remove new ones from this PR * Fix mocha tests * Update more configs * Update config in test * Add note to move these * Missed one * Fix mocha tests * Fix tests
This commit is contained in:
parent
a157513cfa
commit
04ad88cd77
|
@ -119,6 +119,56 @@ export const coreDeprecationProvider: ConfigDeprecationProvider = ({
|
|||
renameFromRoot('xpack.telemetry.config', 'telemetry.config'),
|
||||
renameFromRoot('xpack.telemetry.banner', 'telemetry.banner'),
|
||||
renameFromRoot('xpack.telemetry.url', 'telemetry.url'),
|
||||
// Monitoring renames
|
||||
// TODO: Remove these from here once the monitoring plugin is migrated to NP
|
||||
renameFromRoot('xpack.monitoring.enabled', 'monitoring.enabled'),
|
||||
renameFromRoot('xpack.monitoring.ui.enabled', 'monitoring.ui.enabled'),
|
||||
renameFromRoot(
|
||||
'xpack.monitoring.kibana.collection.enabled',
|
||||
'monitoring.kibana.collection.enabled'
|
||||
),
|
||||
renameFromRoot('xpack.monitoring.max_bucket_size', 'monitoring.ui.max_bucket_size'),
|
||||
renameFromRoot('xpack.monitoring.min_interval_seconds', 'monitoring.ui.min_interval_seconds'),
|
||||
renameFromRoot(
|
||||
'xpack.monitoring.show_license_expiration',
|
||||
'monitoring.ui.show_license_expiration'
|
||||
),
|
||||
renameFromRoot(
|
||||
'xpack.monitoring.ui.container.elasticsearch.enabled',
|
||||
'monitoring.ui.container.elasticsearch.enabled'
|
||||
),
|
||||
renameFromRoot(
|
||||
'xpack.monitoring.ui.container.logstash.enabled',
|
||||
'monitoring.ui.container.logstash.enabled'
|
||||
),
|
||||
renameFromRoot(
|
||||
'xpack.monitoring.tests.cloud_detector.enabled',
|
||||
'monitoring.tests.cloud_detector.enabled'
|
||||
),
|
||||
renameFromRoot(
|
||||
'xpack.monitoring.kibana.collection.interval',
|
||||
'monitoring.kibana.collection.interval'
|
||||
),
|
||||
renameFromRoot('xpack.monitoring.elasticsearch.hosts', 'monitoring.ui.elasticsearch.hosts'),
|
||||
renameFromRoot('xpack.monitoring.elasticsearch.username', 'monitoring.ui.elasticsearch.username'),
|
||||
renameFromRoot('xpack.monitoring.elasticsearch.password', 'monitoring.ui.elasticsearch.password'),
|
||||
renameFromRoot(
|
||||
'xpack.monitoring.xpack_api_polling_frequency_millis',
|
||||
'monitoring.xpack_api_polling_frequency_millis'
|
||||
),
|
||||
renameFromRoot(
|
||||
'xpack.monitoring.cluster_alerts.email_notifications.enabled',
|
||||
'monitoring.cluster_alerts.email_notifications.enabled'
|
||||
),
|
||||
renameFromRoot(
|
||||
'xpack.monitoring.cluster_alerts.email_notifications.email_address',
|
||||
'monitoring.cluster_alerts.email_notifications.email_address'
|
||||
),
|
||||
renameFromRoot('xpack.monitoring.ccs.enabled', 'monitoring.ui.ccs.enabled'),
|
||||
renameFromRoot(
|
||||
'xpack.monitoring.elasticsearch.logFetchCount',
|
||||
'monitoring.ui.elasticsearch.logFetchCount'
|
||||
),
|
||||
configPathDeprecation,
|
||||
dataPathDeprecation,
|
||||
rewriteBasePathDeprecation,
|
||||
|
|
|
@ -15,12 +15,12 @@ export const config = Joi => {
|
|||
const DEFAULT_REQUEST_HEADERS = ['authorization'];
|
||||
|
||||
return Joi.object({
|
||||
ccs: Joi.object({
|
||||
enabled: Joi.boolean().default(true),
|
||||
}).default(),
|
||||
enabled: Joi.boolean().default(true),
|
||||
ui: Joi.object({
|
||||
enabled: Joi.boolean().default(true),
|
||||
ccs: Joi.object({
|
||||
enabled: Joi.boolean().default(true),
|
||||
}).default(),
|
||||
container: Joi.object({
|
||||
elasticsearch: Joi.object({
|
||||
enabled: Joi.boolean().default(false),
|
||||
|
@ -29,6 +29,51 @@ export const config = Joi => {
|
|||
enabled: Joi.boolean().default(false),
|
||||
}).default(),
|
||||
}).default(),
|
||||
max_bucket_size: Joi.number().default(10000),
|
||||
min_interval_seconds: Joi.number().default(10),
|
||||
show_license_expiration: Joi.boolean().default(true),
|
||||
elasticsearch: Joi.object({
|
||||
customHeaders: Joi.object().default({}),
|
||||
logQueries: Joi.boolean().default(false),
|
||||
requestHeadersWhitelist: Joi.array()
|
||||
.items()
|
||||
.single()
|
||||
.default(DEFAULT_REQUEST_HEADERS),
|
||||
sniffOnStart: Joi.boolean().default(false),
|
||||
sniffInterval: Joi.number()
|
||||
.allow(false)
|
||||
.default(false),
|
||||
sniffOnConnectionFault: Joi.boolean().default(false),
|
||||
hosts: Joi.array()
|
||||
.items(Joi.string().uri({ scheme: ['http', 'https'] }))
|
||||
.single(), // if empty, use Kibana's connection config
|
||||
username: Joi.string(),
|
||||
password: Joi.string(),
|
||||
requestTimeout: Joi.number().default(30000),
|
||||
pingTimeout: Joi.number().default(30000),
|
||||
ssl: Joi.object({
|
||||
verificationMode: Joi.string()
|
||||
.valid('none', 'certificate', 'full')
|
||||
.default('full'),
|
||||
certificateAuthorities: Joi.array()
|
||||
.single()
|
||||
.items(Joi.string()),
|
||||
certificate: Joi.string(),
|
||||
key: Joi.string(),
|
||||
keyPassphrase: Joi.string(),
|
||||
keystore: Joi.object({
|
||||
path: Joi.string(),
|
||||
password: Joi.string(),
|
||||
}).default(),
|
||||
truststore: Joi.object({
|
||||
path: Joi.string(),
|
||||
password: Joi.string(),
|
||||
}).default(),
|
||||
alwaysPresentCertificate: Joi.boolean().default(false),
|
||||
}).default(),
|
||||
apiVersion: Joi.string().default('master'),
|
||||
logFetchCount: Joi.number().default(10),
|
||||
}).default(),
|
||||
}).default(),
|
||||
kibana: Joi.object({
|
||||
collection: Joi.object({
|
||||
|
@ -46,56 +91,11 @@ export const config = Joi => {
|
|||
xpack_api_polling_frequency_millis: Joi.number().default(
|
||||
XPACK_INFO_API_DEFAULT_POLL_FREQUENCY_IN_MILLIS
|
||||
),
|
||||
max_bucket_size: Joi.number().default(10000),
|
||||
min_interval_seconds: Joi.number().default(10),
|
||||
show_license_expiration: Joi.boolean().default(true),
|
||||
agent: Joi.object({
|
||||
interval: Joi.string()
|
||||
.regex(/[\d\.]+[yMwdhms]/)
|
||||
.default('10s'),
|
||||
}).default(),
|
||||
elasticsearch: Joi.object({
|
||||
customHeaders: Joi.object().default({}),
|
||||
logQueries: Joi.boolean().default(false),
|
||||
requestHeadersWhitelist: Joi.array()
|
||||
.items()
|
||||
.single()
|
||||
.default(DEFAULT_REQUEST_HEADERS),
|
||||
sniffOnStart: Joi.boolean().default(false),
|
||||
sniffInterval: Joi.number()
|
||||
.allow(false)
|
||||
.default(false),
|
||||
sniffOnConnectionFault: Joi.boolean().default(false),
|
||||
hosts: Joi.array()
|
||||
.items(Joi.string().uri({ scheme: ['http', 'https'] }))
|
||||
.single(), // if empty, use Kibana's connection config
|
||||
username: Joi.string(),
|
||||
password: Joi.string(),
|
||||
requestTimeout: Joi.number().default(30000),
|
||||
pingTimeout: Joi.number().default(30000),
|
||||
ssl: Joi.object({
|
||||
verificationMode: Joi.string()
|
||||
.valid('none', 'certificate', 'full')
|
||||
.default('full'),
|
||||
certificateAuthorities: Joi.array()
|
||||
.single()
|
||||
.items(Joi.string()),
|
||||
certificate: Joi.string(),
|
||||
key: Joi.string(),
|
||||
keyPassphrase: Joi.string(),
|
||||
keystore: Joi.object({
|
||||
path: Joi.string(),
|
||||
password: Joi.string(),
|
||||
}).default(),
|
||||
truststore: Joi.object({
|
||||
path: Joi.string(),
|
||||
password: Joi.string(),
|
||||
}).default(),
|
||||
alwaysPresentCertificate: Joi.boolean().default(false),
|
||||
}).default(),
|
||||
apiVersion: Joi.string().default('master'),
|
||||
logFetchCount: Joi.number().default(10),
|
||||
}).default(),
|
||||
tests: Joi.object({
|
||||
cloud_detector: Joi.object({
|
||||
enabled: Joi.boolean().default(true),
|
||||
|
|
|
@ -20,31 +20,31 @@ export const monitoring = kibana =>
|
|||
new kibana.Plugin({
|
||||
require: ['kibana', 'elasticsearch', 'xpack_main'],
|
||||
id: 'monitoring',
|
||||
configPrefix: 'xpack.monitoring',
|
||||
configPrefix: 'monitoring',
|
||||
publicDir: resolve(__dirname, 'public'),
|
||||
init(server) {
|
||||
const configs = [
|
||||
'xpack.monitoring.ui.enabled',
|
||||
'xpack.monitoring.kibana.collection.enabled',
|
||||
'xpack.monitoring.max_bucket_size',
|
||||
'xpack.monitoring.min_interval_seconds',
|
||||
'monitoring.ui.enabled',
|
||||
'monitoring.kibana.collection.enabled',
|
||||
'monitoring.ui.max_bucket_size',
|
||||
'monitoring.ui.min_interval_seconds',
|
||||
'kibana.index',
|
||||
'xpack.monitoring.show_license_expiration',
|
||||
'xpack.monitoring.ui.container.elasticsearch.enabled',
|
||||
'xpack.monitoring.ui.container.logstash.enabled',
|
||||
'xpack.monitoring.tests.cloud_detector.enabled',
|
||||
'xpack.monitoring.kibana.collection.interval',
|
||||
'xpack.monitoring.elasticsearch.hosts',
|
||||
'xpack.monitoring.elasticsearch',
|
||||
'xpack.monitoring.xpack_api_polling_frequency_millis',
|
||||
'monitoring.ui.show_license_expiration',
|
||||
'monitoring.ui.container.elasticsearch.enabled',
|
||||
'monitoring.ui.container.logstash.enabled',
|
||||
'monitoring.tests.cloud_detector.enabled',
|
||||
'monitoring.kibana.collection.interval',
|
||||
'monitoring.ui.elasticsearch.hosts',
|
||||
'monitoring.ui.elasticsearch',
|
||||
'monitoring.xpack_api_polling_frequency_millis',
|
||||
'server.uuid',
|
||||
'server.name',
|
||||
'server.host',
|
||||
'server.port',
|
||||
'xpack.monitoring.cluster_alerts.email_notifications.enabled',
|
||||
'xpack.monitoring.cluster_alerts.email_notifications.email_address',
|
||||
'xpack.monitoring.ccs.enabled',
|
||||
'xpack.monitoring.elasticsearch.logFetchCount',
|
||||
'monitoring.cluster_alerts.email_notifications.enabled',
|
||||
'monitoring.cluster_alerts.email_notifications.email_address',
|
||||
'monitoring.ui.ccs.enabled',
|
||||
'monitoring.ui.elasticsearch.logFetchCount',
|
||||
];
|
||||
|
||||
const serverConfig = server.config();
|
||||
|
|
|
@ -157,7 +157,7 @@ export function alertsClusterSearch(req, alertsIndex, cluster, checkLicense, opt
|
|||
|
||||
if (prodLicenseInfo.clusterAlerts.enabled) {
|
||||
const config = req.server.config();
|
||||
const size = options.size || config.get('xpack.monitoring.max_bucket_size');
|
||||
const size = options.size || config.get('monitoring.ui.max_bucket_size');
|
||||
|
||||
const params = {
|
||||
index: alertsIndex,
|
||||
|
|
|
@ -19,7 +19,7 @@ export function verifyMonitoringLicense(server) {
|
|||
const config = server.config();
|
||||
|
||||
// if cluster alerts are enabled, then ensure that we can use it according to the license
|
||||
if (config.get('xpack.monitoring.cluster_alerts.enabled')) {
|
||||
if (config.get('monitoring.cluster_alerts.enabled')) {
|
||||
const xpackInfo = get(server.plugins.monitoring, 'info');
|
||||
if (xpackInfo) {
|
||||
const monitoringCluster = xpackInfo.feature('monitoring').getLicenseCheckResults();
|
||||
|
|
|
@ -11,8 +11,8 @@ import { exposeClient, hasMonitoringCluster } from '../instantiate_client';
|
|||
|
||||
function getMockServerFromConnectionUrl(monitoringClusterUrl) {
|
||||
const server = {
|
||||
xpack: {
|
||||
monitoring: {
|
||||
monitoring: {
|
||||
ui: {
|
||||
elasticsearch: {
|
||||
hosts: monitoringClusterUrl ? [monitoringClusterUrl] : [],
|
||||
username: 'monitoring-user-internal-test',
|
||||
|
@ -27,7 +27,7 @@ function getMockServerFromConnectionUrl(monitoringClusterUrl) {
|
|||
};
|
||||
|
||||
return {
|
||||
elasticsearchConfig: server.xpack.monitoring.elasticsearch,
|
||||
elasticsearchConfig: server.monitoring.ui.elasticsearch,
|
||||
elasticsearchPlugin: {
|
||||
getCluster: sinon
|
||||
.stub()
|
||||
|
|
|
@ -168,14 +168,14 @@ describe('throws when config is invalid', () => {
|
|||
it('throws if key and keystore.path are both specified', () => {
|
||||
const value = { ssl: { key: 'foo', keystore: { path: 'bar' } } };
|
||||
expect(() => parse(value)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"[config validation of [xpack.monitoring.elasticsearch].ssl]: cannot use [key] when [keystore.path] is specified"`
|
||||
`"[config validation of [monitoring.ui.elasticsearch].ssl]: cannot use [key] when [keystore.path] is specified"`
|
||||
);
|
||||
});
|
||||
|
||||
it('throws if certificate and keystore.path are both specified', () => {
|
||||
const value = { ssl: { certificate: 'foo', keystore: { path: 'bar' } } };
|
||||
expect(() => parse(value)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"[config validation of [xpack.monitoring.elasticsearch].ssl]: cannot use [certificate] when [keystore.path] is specified"`
|
||||
`"[config validation of [monitoring.ui.elasticsearch].ssl]: cannot use [certificate] when [keystore.path] is specified"`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { readFileSync } from 'fs';
|
||||
import { readPkcs12Truststore, readPkcs12Keystore } from '../../../../../../src/core/utils';
|
||||
|
||||
const KEY = 'xpack.monitoring.elasticsearch';
|
||||
const KEY = 'monitoring.ui.elasticsearch';
|
||||
|
||||
/*
|
||||
* Parse a config object's Elasticsearch configuration, reading any
|
||||
|
|
|
@ -15,7 +15,7 @@ export const initMonitoringXpackInfo = async ({ config, xpackMainPlugin, expose,
|
|||
const xpackInfo = hasMonitoringCluster(config)
|
||||
? xpackMainPlugin.createXPackInfo({
|
||||
clusterSource: 'monitoring',
|
||||
pollFrequencyInMillis: config.get('xpack.monitoring.xpack_api_polling_frequency_millis'),
|
||||
pollFrequencyInMillis: config.get('monitoring.xpack_api_polling_frequency_millis'),
|
||||
})
|
||||
: xpackMainPlugin.info;
|
||||
|
||||
|
|
|
@ -14,14 +14,10 @@ describe('getSettingsCollector / getDefaultAdminEmail', () => {
|
|||
function setup({ enabled = true, adminEmail = null } = {}) {
|
||||
const config = { get: sinon.stub() };
|
||||
|
||||
config.get
|
||||
.withArgs('xpack.monitoring.cluster_alerts.email_notifications.enabled')
|
||||
.returns(enabled);
|
||||
config.get.withArgs('monitoring.cluster_alerts.email_notifications.enabled').returns(enabled);
|
||||
|
||||
if (adminEmail) {
|
||||
config.get
|
||||
.withArgs(`xpack.monitoring.${CLUSTER_ALERTS_ADDRESS_CONFIG_KEY}`)
|
||||
.returns(adminEmail);
|
||||
config.get.withArgs(`monitoring.${CLUSTER_ALERTS_ADDRESS_CONFIG_KEY}`).returns(adminEmail);
|
||||
}
|
||||
|
||||
config.get.withArgs('kibana.index').returns('.kibana');
|
||||
|
@ -31,7 +27,7 @@ describe('getSettingsCollector / getDefaultAdminEmail', () => {
|
|||
return config;
|
||||
}
|
||||
|
||||
describe('xpack.monitoring.cluster_alerts.email_notifications.enabled = false', () => {
|
||||
describe('monitoring.cluster_alerts.email_notifications.enabled = false', () => {
|
||||
it('returns null when email is defined', async () => {
|
||||
const config = setup({ enabled: false });
|
||||
expect(await getDefaultAdminEmail(config)).to.be(null);
|
||||
|
@ -43,7 +39,7 @@ describe('getSettingsCollector / getDefaultAdminEmail', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('xpack.monitoring.cluster_alerts.email_notifications.enabled = true', () => {
|
||||
describe('monitoring.cluster_alerts.email_notifications.enabled = true', () => {
|
||||
it('returns value when email is defined', async () => {
|
||||
const config = setup({ adminEmail: 'hello@world' });
|
||||
expect(await getDefaultAdminEmail(config)).to.be('hello@world');
|
||||
|
|
|
@ -11,11 +11,11 @@ import { CLUSTER_ALERTS_ADDRESS_CONFIG_KEY, KIBANA_SETTINGS_TYPE } from '../../.
|
|||
* If so, get email from kibana.yml
|
||||
*/
|
||||
export async function getDefaultAdminEmail(config) {
|
||||
if (!config.get('xpack.monitoring.cluster_alerts.email_notifications.enabled')) {
|
||||
if (!config.get('monitoring.cluster_alerts.email_notifications.enabled')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const emailAddressConfigKey = `xpack.monitoring.${CLUSTER_ALERTS_ADDRESS_CONFIG_KEY}`;
|
||||
const emailAddressConfigKey = `monitoring.${CLUSTER_ALERTS_ADDRESS_CONFIG_KEY}`;
|
||||
const configuredEmailAddress = config.get(emailAddressConfigKey);
|
||||
|
||||
return configuredEmailAddress || null;
|
||||
|
|
|
@ -17,7 +17,7 @@ export function opsBuffer({ config, log, getOSInfo }) {
|
|||
// determine the cloud service in the background
|
||||
const cloudDetector = new CloudDetector();
|
||||
|
||||
if (config.get('xpack.monitoring.tests.cloud_detector.enabled')) {
|
||||
if (config.get('monitoring.tests.cloud_detector.enabled')) {
|
||||
cloudDetector.detectCloudService();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import { BulkUploader } from './bulk_uploader';
|
|||
* @param {Object} server HapiJS server instance
|
||||
*/
|
||||
export function initBulkUploader({ config, ...params }) {
|
||||
const interval = config.get('xpack.monitoring.kibana.collection.interval');
|
||||
const interval = config.get('monitoring.kibana.collection.interval');
|
||||
return new BulkUploader({
|
||||
interval,
|
||||
config,
|
||||
|
|
|
@ -17,7 +17,7 @@ describe('ccs_utils', () => {
|
|||
const get = sinon.stub();
|
||||
const config = { get };
|
||||
|
||||
get.withArgs('xpack.monitoring.ccs.enabled').returns(false);
|
||||
get.withArgs('monitoring.ui.ccs.enabled').returns(false);
|
||||
|
||||
// falsy string values should be ignored
|
||||
const allPattern = prefixIndexPattern(config, indexPattern, '*');
|
||||
|
@ -32,7 +32,7 @@ describe('ccs_utils', () => {
|
|||
const get = sinon.stub();
|
||||
const config = { get };
|
||||
|
||||
get.withArgs('xpack.monitoring.ccs.enabled').returns(true);
|
||||
get.withArgs('monitoring.ui.ccs.enabled').returns(true);
|
||||
|
||||
// falsy string values should be ignored
|
||||
const undefinedPattern = prefixIndexPattern(config, indexPattern);
|
||||
|
@ -49,7 +49,7 @@ describe('ccs_utils', () => {
|
|||
const get = sinon.stub();
|
||||
const config = { get };
|
||||
|
||||
get.withArgs('xpack.monitoring.ccs.enabled').returns(true);
|
||||
get.withArgs('monitoring.ui.ccs.enabled').returns(true);
|
||||
|
||||
const abcPattern = prefixIndexPattern(config, indexPattern, 'aBc');
|
||||
const underscorePattern = prefixIndexPattern(config, indexPattern, 'cluster_one');
|
||||
|
@ -67,7 +67,7 @@ describe('ccs_utils', () => {
|
|||
const get = sinon.stub();
|
||||
const config = { get };
|
||||
|
||||
get.withArgs('xpack.monitoring.ccs.enabled').returns(true);
|
||||
get.withArgs('monitoring.ui.ccs.enabled').returns(true);
|
||||
|
||||
const pattern = prefixIndexPattern(config, indexPattern, '*');
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ export async function getApms(req, apmIndexPattern, clusterUuid) {
|
|||
|
||||
const params = {
|
||||
index: apmIndexPattern,
|
||||
size: config.get('xpack.monitoring.max_bucket_size'), // FIXME
|
||||
size: config.get('monitoring.ui.max_bucket_size'), // FIXME
|
||||
ignoreUnavailable: true,
|
||||
filterPath: [
|
||||
// only filter path can filter for inner_hits
|
||||
|
|
|
@ -35,7 +35,7 @@ export function getApmsForClusters(req, apmIndexPattern, clusters) {
|
|||
const start = req.payload.timeRange.min;
|
||||
const end = req.payload.timeRange.max;
|
||||
const config = req.server.config();
|
||||
const maxBucketSize = config.get('xpack.monitoring.max_bucket_size');
|
||||
const maxBucketSize = config.get('monitoring.ui.max_bucket_size');
|
||||
|
||||
return Promise.all(
|
||||
clusters.map(async cluster => {
|
||||
|
|
|
@ -28,7 +28,7 @@ export async function getStats(req, apmIndexPattern, clusterUuid) {
|
|||
const config = req.server.config();
|
||||
const start = moment.utc(req.payload.timeRange.min).valueOf();
|
||||
const end = moment.utc(req.payload.timeRange.max).valueOf();
|
||||
const maxBucketSize = config.get('xpack.monitoring.max_bucket_size');
|
||||
const maxBucketSize = config.get('monitoring.ui.max_bucket_size');
|
||||
|
||||
const params = {
|
||||
index: apmIndexPattern,
|
||||
|
|
|
@ -83,7 +83,7 @@ export async function getBeats(req, beatsIndexPattern, clusterUuid) {
|
|||
|
||||
const params = {
|
||||
index: beatsIndexPattern,
|
||||
size: config.get('xpack.monitoring.max_bucket_size'), // FIXME
|
||||
size: config.get('monitoring.ui.max_bucket_size'), // FIXME
|
||||
ignoreUnavailable: true,
|
||||
filterPath: [
|
||||
// only filter path can filter for inner_hits
|
||||
|
|
|
@ -34,7 +34,7 @@ export function getBeatsForClusters(req, beatsIndexPattern, clusters) {
|
|||
const start = req.payload.timeRange.min;
|
||||
const end = req.payload.timeRange.max;
|
||||
const config = req.server.config();
|
||||
const maxBucketSize = config.get('xpack.monitoring.max_bucket_size');
|
||||
const maxBucketSize = config.get('monitoring.ui.max_bucket_size');
|
||||
|
||||
return Promise.all(
|
||||
clusters.map(async cluster => {
|
||||
|
|
|
@ -71,7 +71,7 @@ export function getLatestStats(req, beatsIndexPattern, clusterUuid) {
|
|||
uuids: {
|
||||
terms: {
|
||||
field: 'beats_stats.beat.uuid',
|
||||
size: config.get('xpack.monitoring.max_bucket_size'),
|
||||
size: config.get('monitoring.ui.max_bucket_size'),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -28,7 +28,7 @@ export async function getStats(req, beatsIndexPattern, clusterUuid) {
|
|||
const config = req.server.config();
|
||||
const start = moment.utc(req.payload.timeRange.min).valueOf();
|
||||
const end = moment.utc(req.payload.timeRange.max).valueOf();
|
||||
const maxBucketSize = config.get('xpack.monitoring.max_bucket_size');
|
||||
const maxBucketSize = config.get('monitoring.ui.max_bucket_size');
|
||||
|
||||
const params = {
|
||||
index: beatsIndexPattern,
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* @return {String} The index pattern with the {@code cluster} prefix appropriately prepended.
|
||||
*/
|
||||
export function prefixIndexPattern(config, indexPattern, ccs) {
|
||||
const ccsEnabled = config.get('xpack.monitoring.ccs.enabled');
|
||||
const ccsEnabled = config.get('monitoring.ui.ccs.enabled');
|
||||
|
||||
if (!ccsEnabled || !ccs) {
|
||||
return indexPattern;
|
||||
|
|
|
@ -46,7 +46,7 @@ function fetchClusterStats(req, esIndexPattern, clusterUuid) {
|
|||
const metric = ElasticsearchMetric.getMetricFields();
|
||||
const params = {
|
||||
index: esIndexPattern,
|
||||
size: config.get('xpack.monitoring.max_bucket_size'),
|
||||
size: config.get('monitoring.ui.max_bucket_size'),
|
||||
ignoreUnavailable: true,
|
||||
filterPath: [
|
||||
'hits.hits._index',
|
||||
|
|
|
@ -20,7 +20,7 @@ function getMockReq(metricsBuckets = []) {
|
|||
get: sinon.stub(),
|
||||
};
|
||||
|
||||
config.get.withArgs('xpack.monitoring.min_interval_seconds').returns(10);
|
||||
config.get.withArgs('monitoring.ui.min_interval_seconds').returns(10);
|
||||
|
||||
return {
|
||||
server: {
|
||||
|
|
|
@ -28,7 +28,7 @@ export async function getMetrics(
|
|||
// TODO: Pass in req parameters as explicit function parameters
|
||||
let min = moment.utc(req.payload.timeRange.min).valueOf();
|
||||
const max = moment.utc(req.payload.timeRange.max).valueOf();
|
||||
const minIntervalSeconds = config.get('xpack.monitoring.min_interval_seconds');
|
||||
const minIntervalSeconds = config.get('monitoring.ui.min_interval_seconds');
|
||||
const bucketSize = calculateTimeseriesInterval(min, max, minIntervalSeconds);
|
||||
const timezone = await getTimezone(req);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ export function getMlJobs(req, esIndexPattern) {
|
|||
checkParam(esIndexPattern, 'esIndexPattern in getMlJobs');
|
||||
|
||||
const config = req.server.config();
|
||||
const maxBucketSize = config.get('xpack.monitoring.max_bucket_size');
|
||||
const maxBucketSize = config.get('monitoring.ui.max_bucket_size');
|
||||
const start = req.payload.timeRange.min; // no wrapping in moment :)
|
||||
const end = req.payload.timeRange.max;
|
||||
const clusterUuid = req.params.clusterUuid;
|
||||
|
|
|
@ -97,7 +97,7 @@ export function getIndices(req, esIndexPattern, showSystemIndices = false, shard
|
|||
const params = {
|
||||
index: esIndexPattern,
|
||||
// TODO: composite aggregation
|
||||
size: config.get('xpack.monitoring.max_bucket_size'),
|
||||
size: config.get('monitoring.ui.max_bucket_size'),
|
||||
ignoreUnavailable: true,
|
||||
filterPath: [
|
||||
// only filter path can filter for inner_hits
|
||||
|
|
|
@ -44,7 +44,7 @@ export async function getNodes(req, esIndexPattern, pageOfNodes, clusterStats, n
|
|||
const min = start;
|
||||
|
||||
const bucketSize = Math.max(
|
||||
config.get('xpack.monitoring.min_interval_seconds'),
|
||||
config.get('monitoring.ui.min_interval_seconds'),
|
||||
calculateAuto(100, duration).asSeconds()
|
||||
);
|
||||
|
||||
|
@ -59,7 +59,7 @@ export async function getNodes(req, esIndexPattern, pageOfNodes, clusterStats, n
|
|||
|
||||
const params = {
|
||||
index: esIndexPattern,
|
||||
size: config.get('xpack.monitoring.max_bucket_size'),
|
||||
size: config.get('monitoring.ui.max_bucket_size'),
|
||||
ignoreUnavailable: true,
|
||||
body: {
|
||||
query: createQuery({
|
||||
|
@ -78,7 +78,7 @@ export async function getNodes(req, esIndexPattern, pageOfNodes, clusterStats, n
|
|||
terms: {
|
||||
field: `source_node.uuid`,
|
||||
include: uuidsToInclude,
|
||||
size: config.get('xpack.monitoring.max_bucket_size'),
|
||||
size: config.get('monitoring.ui.max_bucket_size'),
|
||||
},
|
||||
aggs: {
|
||||
by_date: {
|
||||
|
|
|
@ -38,7 +38,7 @@ export async function getPaginatedNodes(
|
|||
{ clusterStats, nodesShardCount }
|
||||
) {
|
||||
const config = req.server.config();
|
||||
const size = config.get('xpack.monitoring.max_bucket_size');
|
||||
const size = config.get('monitoring.ui.max_bucket_size');
|
||||
const nodes = await getNodeIds(req, esIndexPattern, { clusterUuid }, size);
|
||||
|
||||
// Add `isOnline` and shards from the cluster state and shard stats
|
||||
|
@ -63,7 +63,7 @@ export async function getPaginatedNodes(
|
|||
const groupBy = {
|
||||
field: `source_node.uuid`,
|
||||
include: nodes.map(node => node.uuid),
|
||||
size: config.get('xpack.monitoring.max_bucket_size'),
|
||||
size: config.get('monitoring.ui.max_bucket_size'),
|
||||
};
|
||||
const metricSeriesData = await getMetrics(
|
||||
req,
|
||||
|
|
|
@ -12,7 +12,7 @@ import { calculateIndicesTotals } from './calculate_shard_stat_indices_totals';
|
|||
|
||||
async function getUnassignedShardData(req, esIndexPattern, cluster) {
|
||||
const config = req.server.config();
|
||||
const maxBucketSize = config.get('xpack.monitoring.max_bucket_size');
|
||||
const maxBucketSize = config.get('monitoring.ui.max_bucket_size');
|
||||
const metric = ElasticsearchMetric.getMetricFields();
|
||||
|
||||
const params = {
|
||||
|
|
|
@ -11,7 +11,7 @@ import { ElasticsearchMetric } from '../../metrics';
|
|||
|
||||
async function getShardCountPerNode(req, esIndexPattern, cluster) {
|
||||
const config = req.server.config();
|
||||
const maxBucketSize = config.get('xpack.monitoring.max_bucket_size');
|
||||
const maxBucketSize = config.get('monitoring.ui.max_bucket_size');
|
||||
const metric = ElasticsearchMetric.getMetricFields();
|
||||
|
||||
const params = {
|
||||
|
|
|
@ -55,7 +55,7 @@ export function getShardAllocation(
|
|||
const metric = ElasticsearchMetric.getMetricFields();
|
||||
const params = {
|
||||
index: esIndexPattern,
|
||||
size: config.get('xpack.monitoring.max_bucket_size'),
|
||||
size: config.get('monitoring.ui.max_bucket_size'),
|
||||
ignoreUnavailable: true,
|
||||
body: {
|
||||
query: createQuery({ type: 'shards', clusterUuid, metric, filters }),
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* @param {Boolean} includeNodes - whether to add the aggs for node shards
|
||||
*/
|
||||
export function getShardAggs(config, includeNodes, includeIndices) {
|
||||
const maxBucketSize = config.get('xpack.monitoring.max_bucket_size');
|
||||
const maxBucketSize = config.get('monitoring.ui.max_bucket_size');
|
||||
const aggSize = 10;
|
||||
const indicesAgg = {
|
||||
terms: {
|
||||
|
|
|
@ -31,7 +31,7 @@ export function getKibanas(req, kbnIndexPattern, { clusterUuid }) {
|
|||
|
||||
const params = {
|
||||
index: kbnIndexPattern,
|
||||
size: config.get('xpack.monitoring.max_bucket_size'),
|
||||
size: config.get('monitoring.ui.max_bucket_size'),
|
||||
ignoreUnavailable: true,
|
||||
body: {
|
||||
query: createQuery({
|
||||
|
|
|
@ -49,7 +49,7 @@ export function getKibanasForClusters(req, kbnIndexPattern, clusters) {
|
|||
kibana_uuids: {
|
||||
terms: {
|
||||
field: 'kibana_stats.kibana.uuid',
|
||||
size: config.get('xpack.monitoring.max_bucket_size'),
|
||||
size: config.get('monitoring.ui.max_bucket_size'),
|
||||
},
|
||||
aggs: {
|
||||
latest_report: {
|
||||
|
|
|
@ -70,7 +70,7 @@ export async function getLogs(
|
|||
|
||||
const params = {
|
||||
index: filebeatIndexPattern,
|
||||
size: Math.min(50, config.get('xpack.monitoring.elasticsearch.logFetchCount')),
|
||||
size: Math.min(50, config.get('monitoring.ui.elasticsearch.logFetchCount')),
|
||||
filterPath: [
|
||||
'hits.hits._source.message',
|
||||
'hits.hits._source.log.level',
|
||||
|
|
|
@ -60,7 +60,7 @@ export function getLogstashForClusters(req, lsIndexPattern, clusters) {
|
|||
logstash_uuids: {
|
||||
terms: {
|
||||
field: 'logstash_stats.logstash.uuid',
|
||||
size: config.get('xpack.monitoring.max_bucket_size'),
|
||||
size: config.get('monitoring.ui.max_bucket_size'),
|
||||
},
|
||||
aggs: {
|
||||
latest_report: {
|
||||
|
@ -119,7 +119,7 @@ export function getLogstashForClusters(req, lsIndexPattern, clusters) {
|
|||
logstash_versions: {
|
||||
terms: {
|
||||
field: 'logstash_stats.logstash.version',
|
||||
size: config.get('xpack.monitoring.max_bucket_size'),
|
||||
size: config.get('monitoring.ui.max_bucket_size'),
|
||||
},
|
||||
},
|
||||
pipelines_nested: {
|
||||
|
@ -135,7 +135,7 @@ export function getLogstashForClusters(req, lsIndexPattern, clusters) {
|
|||
queue_types: {
|
||||
terms: {
|
||||
field: 'logstash_stats.pipelines.queue.type',
|
||||
size: config.get('xpack.monitoring.max_bucket_size'),
|
||||
size: config.get('monitoring.ui.max_bucket_size'),
|
||||
},
|
||||
aggs: {
|
||||
num_pipelines: {
|
||||
|
|
|
@ -31,7 +31,7 @@ export function getNodes(req, lsIndexPattern, { clusterUuid }) {
|
|||
|
||||
const params = {
|
||||
index: lsIndexPattern,
|
||||
size: config.get('xpack.monitoring.max_bucket_size'), // FIXME
|
||||
size: config.get('monitoring.ui.max_bucket_size'), // FIXME
|
||||
ignoreUnavailable: true,
|
||||
body: {
|
||||
query: createQuery({
|
||||
|
|
|
@ -37,7 +37,7 @@ export async function getPaginatedPipelines(
|
|||
queryText
|
||||
) {
|
||||
const config = req.server.config();
|
||||
const size = config.get('xpack.monitoring.max_bucket_size');
|
||||
const size = config.get('monitoring.ui.max_bucket_size');
|
||||
const pipelines = await getLogstashPipelineIds(
|
||||
req,
|
||||
lsIndexPattern,
|
||||
|
|
|
@ -111,7 +111,7 @@ export async function getPipeline(req, config, lsIndexPattern, clusterUuid, pipe
|
|||
};
|
||||
|
||||
// Determine metrics' timeseries interval based on version's timespan
|
||||
const minIntervalSeconds = config.get('xpack.monitoring.min_interval_seconds');
|
||||
const minIntervalSeconds = config.get('monitoring.ui.min_interval_seconds');
|
||||
const timeseriesInterval = calculateTimeseriesInterval(
|
||||
version.firstSeen,
|
||||
version.lastSeen,
|
||||
|
|
|
@ -171,7 +171,7 @@ export function getPipelineStatsAggregation(
|
|||
logstashIndexPattern,
|
||||
pipelineId,
|
||||
version,
|
||||
config.get('xpack.monitoring.max_bucket_size'),
|
||||
config.get('monitoring.ui.max_bucket_size'),
|
||||
callWithRequest,
|
||||
req
|
||||
);
|
||||
|
|
|
@ -37,7 +37,7 @@ function fetchPipelineVersions(...args) {
|
|||
by_pipeline_hash: {
|
||||
terms: {
|
||||
field: 'logstash_stats.pipelines.hash',
|
||||
size: config.get('xpack.monitoring.max_bucket_size'),
|
||||
size: config.get('monitoring.ui.max_bucket_size'),
|
||||
order: { 'path_to_root>first_seen': 'desc' },
|
||||
},
|
||||
aggs: {
|
||||
|
|
|
@ -130,7 +130,7 @@ export async function getPipelineVertex(
|
|||
};
|
||||
|
||||
// Determine metrics' timeseries interval based on version's timespan
|
||||
const minIntervalSeconds = config.get('xpack.monitoring.min_interval_seconds');
|
||||
const minIntervalSeconds = config.get('monitoring.ui.min_interval_seconds');
|
||||
const timeseriesInterval = calculateTimeseriesInterval(
|
||||
version.firstSeen,
|
||||
version.lastSeen,
|
||||
|
|
|
@ -216,7 +216,7 @@ export function getPipelineVertexStatsAggregation(
|
|||
version,
|
||||
vertexId,
|
||||
timeSeriesIntervalInSeconds,
|
||||
config.get('xpack.monitoring.max_bucket_size'),
|
||||
config.get('monitoring.ui.max_bucket_size'),
|
||||
callWithRequest,
|
||||
req
|
||||
);
|
||||
|
|
|
@ -48,7 +48,7 @@ export class Plugin {
|
|||
/*
|
||||
* End-user-facing services
|
||||
*/
|
||||
const uiEnabled = config.get('xpack.monitoring.ui.enabled');
|
||||
const uiEnabled = config.get('monitoring.ui.enabled');
|
||||
|
||||
if (uiEnabled) {
|
||||
await instantiateClient({
|
||||
|
@ -98,7 +98,7 @@ export class Plugin {
|
|||
kbnServerStatus: kbnServer.status,
|
||||
kbnServerVersion: kbnServer.version,
|
||||
});
|
||||
const kibanaCollectionEnabled = config.get('xpack.monitoring.kibana.collection.enabled');
|
||||
const kibanaCollectionEnabled = config.get('monitoring.kibana.collection.enabled');
|
||||
|
||||
if (kibanaCollectionEnabled) {
|
||||
/*
|
||||
|
@ -125,14 +125,12 @@ export class Plugin {
|
|||
core.injectUiAppVars('monitoring', () => {
|
||||
const config = core.config();
|
||||
return {
|
||||
maxBucketSize: config.get('xpack.monitoring.max_bucket_size'),
|
||||
minIntervalSeconds: config.get('xpack.monitoring.min_interval_seconds'),
|
||||
maxBucketSize: config.get('monitoring.ui.max_bucket_size'),
|
||||
minIntervalSeconds: config.get('monitoring.ui.min_interval_seconds'),
|
||||
kbnIndex: config.get('kibana.index'),
|
||||
showLicenseExpiration: config.get('xpack.monitoring.show_license_expiration'),
|
||||
showCgroupMetricsElasticsearch: config.get(
|
||||
'xpack.monitoring.ui.container.elasticsearch.enabled'
|
||||
),
|
||||
showCgroupMetricsLogstash: config.get('xpack.monitoring.ui.container.logstash.enabled'), // Note, not currently used, but see https://github.com/elastic/x-pack-kibana/issues/1559 part 2
|
||||
showLicenseExpiration: config.get('monitoring.ui.show_license_expiration'),
|
||||
showCgroupMetricsElasticsearch: config.get('monitoring.ui.container.elasticsearch.enabled'),
|
||||
showCgroupMetricsLogstash: config.get('monitoring.ui.container.logstash.enabled'), // Note, not currently used, but see https://github.com/elastic/x-pack-kibana/issues/1559 part 2
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ function getBucketScript(max, min) {
|
|||
function buildRequest(req, config, esIndexPattern) {
|
||||
const min = moment.utc(req.payload.timeRange.min).valueOf();
|
||||
const max = moment.utc(req.payload.timeRange.max).valueOf();
|
||||
const maxBucketSize = config.get('xpack.monitoring.max_bucket_size');
|
||||
const maxBucketSize = config.get('monitoring.ui.max_bucket_size');
|
||||
const aggs = {
|
||||
ops_synced_max: {
|
||||
max: {
|
||||
|
|
|
@ -61,7 +61,7 @@ export function esNodeRoute(server) {
|
|||
metricSet = metricSetOverview;
|
||||
// set the cgroup option if needed
|
||||
const showCgroupMetricsElasticsearch = config.get(
|
||||
'xpack.monitoring.ui.container.elasticsearch.enabled'
|
||||
'monitoring.ui.container.elasticsearch.enabled'
|
||||
);
|
||||
const metricCpu = metricSet.find(m => m.name === 'node_cpu_metric');
|
||||
if (showCgroupMetricsElasticsearch) {
|
||||
|
|
|
@ -60,9 +60,7 @@ export function logstashNodeRoute(server) {
|
|||
} else {
|
||||
metricSet = metricSetOverview;
|
||||
// set the cgroup option if needed
|
||||
const showCgroupMetricsLogstash = config.get(
|
||||
'xpack.monitoring.ui.container.logstash.enabled'
|
||||
);
|
||||
const showCgroupMetricsLogstash = config.get('monitoring.ui.container.logstash.enabled');
|
||||
const metricCpu = metricSet.find(m => m.name === 'logstash_node_cpu_metric');
|
||||
if (showCgroupMetricsLogstash) {
|
||||
metricCpu.keys = ['logstash_node_cgroup_quota_as_cpu_utilization'];
|
||||
|
|
|
@ -36,7 +36,7 @@ export function logstashClusterPipelineIdsRoute(server) {
|
|||
const { ccs } = req.payload;
|
||||
const clusterUuid = req.params.clusterUuid;
|
||||
const lsIndexPattern = prefixIndexPattern(config, INDEX_PATTERN_LOGSTASH, ccs);
|
||||
const size = config.get('xpack.monitoring.max_bucket_size');
|
||||
const size = config.get('monitoring.ui.max_bucket_size');
|
||||
|
||||
try {
|
||||
const pipelines = await getLogstashPipelineIds(req, lsIndexPattern, { clusterUuid }, size);
|
||||
|
|
|
@ -40,7 +40,7 @@ export function fetchClusterUuids({ server, callCluster, start, end }: StatsColl
|
|||
cluster_uuids: {
|
||||
terms: {
|
||||
field: 'cluster_uuid',
|
||||
size: config.get('xpack.monitoring.max_bucket_size'),
|
||||
size: config.get('monitoring.ui.max_bucket_size'),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -31,7 +31,7 @@ export function fetchElasticsearchStats(server, callCluster, clusterUuids) {
|
|||
const config = server.config();
|
||||
const params = {
|
||||
index: INDEX_PATTERN_ELASTICSEARCH,
|
||||
size: config.get('xpack.monitoring.max_bucket_size'),
|
||||
size: config.get('monitoring.ui.max_bucket_size'),
|
||||
ignoreUnavailable: true,
|
||||
filterPath: [
|
||||
'hits.hits._source.cluster_uuid',
|
||||
|
|
|
@ -217,7 +217,7 @@ export async function fetchHighLevelStats(server, callCluster, clusterUuids, sta
|
|||
|
||||
const params = {
|
||||
index: getIndexPatternForStackProduct(product),
|
||||
size: config.get('xpack.monitoring.max_bucket_size'),
|
||||
size: config.get('monitoring.ui.max_bucket_size'),
|
||||
headers: {
|
||||
'X-QUERY-SOURCE': TELEMETRY_QUERY_SOURCE,
|
||||
},
|
||||
|
|
|
@ -32,7 +32,7 @@ export const getUiExports = () => ({
|
|||
injectDefaultVars(server) {
|
||||
const config = server.config();
|
||||
return {
|
||||
monitoringUiEnabled: config.get('xpack.monitoring.ui.enabled'),
|
||||
monitoringUiEnabled: config.get('monitoring.ui.enabled'),
|
||||
};
|
||||
},
|
||||
hacks: ['plugins/monitoring/hacks/toggle_app_link_in_nav'],
|
||||
|
|
Loading…
Reference in a new issue