From 19093e7e8657579ea00736d456e6e4bff92dc1f3 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Mon, 5 Nov 2018 17:37:23 +0000 Subject: [PATCH 1/2] fix(NA): add support for nodejs 10 pipeline api. --- lib/monitor.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/monitor.js b/lib/monitor.js index 6a14015..17c6a7e 100755 --- a/lib/monitor.js +++ b/lib/monitor.js @@ -7,6 +7,7 @@ const Os = require('os'); const Hoek = require('hoek'); const Oppsy = require('oppsy'); const Pumpify = require('pumpify'); +const { pipeline } = require('stream'); const Package = require('../package.json'); const Utils = require('./utils'); @@ -122,11 +123,18 @@ class Monitor { streamObjs.unshift(new Utils.NoOp()); } - this._reporters.set(reporterName, Pumpify.obj(streamObjs)).get(reporterName).on('error', (err) => { + const combinedStreamErrHandler = (err) => { + if (err) { + console.error(`There was a problem (${err}) in ${reporterName} and it has been destroyed.`); + console.error(err); + } + } - console.error(`There was a problem (${err}) in ${reporterName} and it has been destroyed.`); - console.error(err); - }); + const combinedStream = pipeline + ? pipeline(...streamObjs, combinedStreamErrHandler) + : Pumpify.obj(streamObjs).on('error', combinedStreamErrHandler); + + this._reporters.set(reporterName, combinedStream); }); this._state.report = true; From 49e9c187292b433a2f278a712bc8fde35dd67b1c Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Mon, 5 Nov 2018 17:39:22 +0000 Subject: [PATCH 2/2] chore(NA): bump version. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 83571e3..7d9a98f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@elastic/good", "description": "Server and process monitoring plugin", - "version": "8.1.1-kibana1", + "version": "8.1.1-kibana2", "repository": "git://github.com/elastic/good", "main": "lib/index.js", "keywords": [