Skip to content

Commit

Permalink
[Monitoring] Fix logging when Monitoring reinitializes with HUP signal (
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Aug 29, 2018
1 parent 5bc6ac4 commit 086baf4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/monitoring/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
import { getKibanaInfoForStats } from '../lib';

Expand Down Expand Up @@ -35,11 +39,17 @@ export function getOpsStatsCollector(server, kbnServer) {

// `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
});

Expand Down

0 comments on commit 086baf4

Please sign in to comment.