From f8b94d9da0f287dab0d6fe535a12586a3b29a348 Mon Sep 17 00:00:00 2001 From: Timothy Sullivan Date: Tue, 28 Aug 2018 09:40:39 -0700 Subject: [PATCH] [Monitoring] Fix logging when Monitoring reinitializes with HUP signal --- x-pack/plugins/monitoring/init.js | 2 +- .../collectors/get_ops_stats_collector.js | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/monitoring/init.js b/x-pack/plugins/monitoring/init.js index 84c23c3774b6fb..24aecb4a604d30 100644 --- a/x-pack/plugins/monitoring/init.js +++ b/x-pack/plugins/monitoring/init.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { LOGGING_TAG, KIBANA_MONITORING_LOGGING_TAG, } from './common/constants'; +import { LOGGING_TAG, KIBANA_MONITORING_LOGGING_TAG } from './common/constants'; import { requireUIRoutes } from './server/routes'; import { instantiateClient } from './server/es_client/instantiate_client'; import { initMonitoringXpackInfo } from './server/init_monitoring_xpack_info'; diff --git a/x-pack/plugins/monitoring/server/kibana_monitoring/collectors/get_ops_stats_collector.js b/x-pack/plugins/monitoring/server/kibana_monitoring/collectors/get_ops_stats_collector.js index baad3916934513..6528abd7a361a3 100644 --- a/x-pack/plugins/monitoring/server/kibana_monitoring/collectors/get_ops_stats_collector.js +++ b/x-pack/plugins/monitoring/server/kibana_monitoring/collectors/get_ops_stats_collector.js @@ -4,7 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ -import { KIBANA_STATS_TYPE_MONITORING } from '../../../common/constants'; +import { + LOGGING_TAG, + KIBANA_MONITORING_LOGGING_TAG, + KIBANA_STATS_TYPE_MONITORING, +} from '../../../common/constants'; import { opsBuffer } from './ops_buffer'; /* @@ -34,11 +38,17 @@ export function getOpsStatsCollector(server) { // `process` is a NodeJS global, and is always available without using require/import process.on('SIGHUP', () => { - this.log.info('Re-initializing Kibana Monitoring due to SIGHUP'); + server.log( + ['info', LOGGING_TAG, KIBANA_MONITORING_LOGGING_TAG], + 'Re-initializing Kibana Monitoring due to SIGHUP' + ); setTimeout(() => { stop(); start(); - this.log.info('Re-initialized Kibana Monitoring due to SIGHUP'); + server.log( + ['info', LOGGING_TAG, KIBANA_MONITORING_LOGGING_TAG], + 'Re-initialized Kibana Monitoring due to SIGHUP' + ); }, 5 * 1000); // wait 5 seconds to avoid race condition with reloading logging configuration });