From d6642b731c016dfbfe417e761c868bd7938a7d1c Mon Sep 17 00:00:00 2001 From: Dries Hugaerts Date: Thu, 27 May 2021 11:53:14 +0200 Subject: [PATCH 01/10] implementation of a very simple health endpoint. --- app.js | 208 ++++++++++++++++++++++++++------------------------ lib/health.js | 26 +++++++ package.json | 1 + 3 files changed, 135 insertions(+), 100 deletions(-) create mode 100644 lib/health.js diff --git a/app.js b/app.js index 97c710a..9fc9f12 100644 --- a/app.js +++ b/app.js @@ -3,140 +3,143 @@ import request from 'request'; import services from '/config/rules.js'; import bodyParser from 'body-parser'; import dns from 'dns'; +import { FAILURES } from './lib/health'; +import dayjs from 'dayjs'; // Also parse application/json as json -app.use( bodyParser.json( { +app.use(bodyParser.json({ type: function(req) { - return /^application\/json/.test( req.get('content-type') ); + return /^application\/json/.test(req.get('content-type')); }, limit: '500mb' -} ) ); +})); // Log server config if requested -if( process.env["LOG_SERVER_CONFIGURATION"] ) - console.log(JSON.stringify( services )); +if (process.env['LOG_SERVER_CONFIGURATION']) + console.log(JSON.stringify(services)); -app.get( '/', function( req, res ) { +app.get('/', function(req, res) { res.status(200); - res.send("Hello, delta notification is running"); -} ); + res.send('Hello, delta notification is running'); +}); -app.post( '/', function( req, res ) { - if( process.env["LOG_REQUESTS"] ) { - console.log("Logging request body"); +app.post('/', function(req, res) { + if (process.env['LOG_REQUESTS']) { + console.log('Logging request body'); console.log(req.body); } const changeSets = req.body.changeSets; - const originalMuCallIdTrail = JSON.parse( req.get('mu-call-id-trail') || "[]" ); + const originalMuCallIdTrail = JSON.parse(req.get('mu-call-id-trail') || '[]'); const originalMuCallId = req.get('mu-call-id'); - const muCallIdTrail = JSON.stringify( [...originalMuCallIdTrail, originalMuCallId] ); + const muCallIdTrail = JSON.stringify([...originalMuCallIdTrail, originalMuCallId]); - changeSets.forEach( (change) => { + changeSets.forEach((change) => { change.insert = change.insert || []; change.delete = change.delete || []; - } ); + }); // inform watchers - informWatchers( changeSets, res, muCallIdTrail ); + informWatchers(changeSets, res, muCallIdTrail); // push relevant data to interested actors res.status(204).send(); -} ); +}); -async function informWatchers( changeSets, res, muCallIdTrail ){ - services.map( async (entry) => { - // for each entity - if( process.env["DEBUG_DELTA_MATCH"] ) - console.log(`Checking if we want to send to ${entry.callback.url}`); +async function informWatchers(changeSets, res, muCallIdTrail) { + try { + services.map(async (entry) => { + // for each entity + if (process.env['DEBUG_DELTA_MATCH']) + console.log(`Checking if we want to send to ${entry.callback.url}`); - const matchSpec = entry.match; + const matchSpec = entry.match; - const originFilteredChangeSets = await filterMatchesForOrigin( changeSets, entry ); - if( process.env["DEBUG_TRIPLE_MATCHES_SPEC"] && entry.options.ignoreFromSelf ) - console.log(`There are ${originFilteredChangeSets.length} changes sets not from ${hostnameForEntry( entry )}`); + const originFilteredChangeSets = await filterMatchesForOrigin(changeSets, entry); + if (process.env['DEBUG_TRIPLE_MATCHES_SPEC'] && entry.options.ignoreFromSelf) + console.log(`There are ${originFilteredChangeSets.length} changes sets not from ${hostnameForEntry(entry)}`); - let allInserts = []; - let allDeletes = []; + let allInserts = []; + let allDeletes = []; - originFilteredChangeSets.forEach( (change) => { - allInserts = [...allInserts, ...change.insert]; - allDeletes = [...allDeletes, ...change.delete]; - } ); + originFilteredChangeSets.forEach((change) => { + allInserts = [...allInserts, ...change.insert]; + allDeletes = [...allDeletes, ...change.delete]; + }); - const changedTriples = [...allInserts, ...allDeletes]; + const changedTriples = [...allInserts, ...allDeletes]; - const someTripleMatchedSpec = - changedTriples - .some( (triple) => tripleMatchesSpec( triple, matchSpec ) ); + const someTripleMatchedSpec = + changedTriples.some((triple) => tripleMatchesSpec(triple, matchSpec)); - if( process.env["DEBUG_TRIPLE_MATCHES_SPEC"] ) - console.log(`Triple matches spec? ${someTripleMatchedSpec}`); + if (process.env['DEBUG_TRIPLE_MATCHES_SPEC']) + console.log(`Triple matches spec? ${someTripleMatchedSpec}`); - if( someTripleMatchedSpec ) { - // inform matching entities - if( process.env["DEBUG_DELTA_SEND"] ) - console.log(`Going to send ${entry.callback.method} to ${entry.callback.url}`); + if (someTripleMatchedSpec) { + // inform matching entities + if (process.env['DEBUG_DELTA_SEND']) + console.log(`Going to send ${entry.callback.method} to ${entry.callback.url}`); - if( entry.options && entry.options.gracePeriod ) { - setTimeout( - () => sendRequest( entry, originFilteredChangeSets, muCallIdTrail ), - entry.options.gracePeriod ); - } else { - sendRequest( entry, originFilteredChangeSets, muCallIdTrail ); + if (entry.options && entry.options.gracePeriod) { + setTimeout( + () => sendRequest(entry, originFilteredChangeSets, muCallIdTrail), + entry.options.gracePeriod); + } else { + sendRequest(entry, originFilteredChangeSets, muCallIdTrail); + } } - } - } ); + }); + } catch (error) { + FAILURES.push({ + error, + date: dayjs.now() + }); + } } -function tripleMatchesSpec( triple, matchSpec ) { +function tripleMatchesSpec(triple, matchSpec) { // form of triple is {s, p, o}, same as matchSpec - if( process.env["DEBUG_TRIPLE_MATCHES_SPEC"] ) + if (process.env['DEBUG_TRIPLE_MATCHES_SPEC']) console.log(`Does ${JSON.stringify(triple)} match ${JSON.stringify(matchSpec)}?`); - for( let key in matchSpec ){ + for (let key in matchSpec) { // key is one of s, p, o const subMatchSpec = matchSpec[key]; const subMatchValue = triple[key]; - if( subMatchSpec && !subMatchValue ) + if (subMatchSpec && !subMatchValue) return false; - for( let subKey in subMatchSpec ) - // we're now matching something like {type: "url", value: "http..."} - if( subMatchSpec[subKey] !== subMatchValue[subKey] ) + for (let subKey in subMatchSpec) + // we're now matching something like {type: "url", value: "http..."} + if (subMatchSpec[subKey] !== subMatchValue[subKey]) return false; } return true; // no false matches found, let's send a response } - -function formatChangesetBody( changeSets, options ) { - if( options.resourceFormat == "v0.0.1" ) { +function formatChangesetBody(changeSets, options) { + if (options.resourceFormat == 'v0.0.1') { return JSON.stringify( - changeSets.map( (change) => { - return { - inserts: change.insert, - deletes: change.delete - }; - } ) ); + changeSets.map((change) => { + return { + inserts: change.insert, + deletes: change.delete + }; + })); } - if( options.resourceFormat == "v0.0.0-genesis" ) { + if (options.resourceFormat == 'v0.0.0-genesis') { // [{delta: {inserts, deletes}] - const newOptions = Object.assign({}, options, { resourceFormat: "v0.0.1" }); - const newFormat = JSON.parse( formatChangesetBody( changeSets, newOptions ) ); + const newOptions = Object.assign({}, options, {resourceFormat: 'v0.0.1'}); + const newFormat = JSON.parse(formatChangesetBody(changeSets, newOptions)); return JSON.stringify({ // graph: Not available delta: { - inserts: newFormat - .flatMap( ({inserts}) => inserts) - .map( ({subject,predicate,object}) => - ( { s: subject.value, p: predicate.value, o: object.value } ) ), - deletes: newFormat - .flatMap( ({deletes}) => deletes) - .map( ({subject,predicate,object}) => - ( { s: subject.value, p: predicate.value, o: object.value } ) ) + inserts: newFormat.flatMap(({inserts}) => inserts).map(({subject, predicate, object}) => + ({s: subject.value, p: predicate.value, o: object.value})), + deletes: newFormat.flatMap(({deletes}) => deletes).map(({subject, predicate, object}) => + ({s: subject.value, p: predicate.value, o: object.value})) } }); } else { @@ -144,17 +147,22 @@ function formatChangesetBody( changeSets, options ) { } } -async function sendRequest( entry, changeSets, muCallIdTrail ) { +async function sendRequest(entry, changeSets, muCallIdTrail) { let requestObject; // will contain request information // construct the requestObject const method = entry.callback.method; const url = entry.callback.url; - const headers = { "Content-Type": "application/json", "MU-AUTH-ALLOWED-GROUPS": changeSets[0].allowedGroups, "mu-call-id-trail": muCallIdTrail, "mu-call-id": uuid() }; - - if( entry.options && entry.options.resourceFormat ) { + const headers = { + 'Content-Type': 'application/json', + 'MU-AUTH-ALLOWED-GROUPS': changeSets[0].allowedGroups, + 'mu-call-id-trail': muCallIdTrail, + 'mu-call-id': uuid() + }; + + if (entry.options && entry.options.resourceFormat) { // we should send contents - const body = formatChangesetBody( changeSets, entry.options ); + const body = formatChangesetBody(changeSets, entry.options); // TODO: we now assume the mu-auth-allowed-groups will be the same // for each changeSet. that's a simplification and we should not @@ -167,46 +175,46 @@ async function sendRequest( entry, changeSets, muCallIdTrail ) { }; } else { // we should only inform - requestObject = { url, method, headers }; + requestObject = {url, method, headers}; } - if( process.env["DEBUG_DELTA_SEND"] ) + if (process.env['DEBUG_DELTA_SEND']) console.log(`Executing send ${method} to ${url}`); - request( requestObject, function( error, response, body ) { - if( error ) { + request(requestObject, function(error, response, body) { + if (error) { console.log(`Could not send request ${method} ${url}`); console.log(error); console.log(`NOT RETRYING`); // TODO: retry a few times when delta's fail to send } - if( response ) { + if (response) { // console.log( body ); } }); } -async function filterMatchesForOrigin( changeSets, entry ) { - if( ! entry.options || !entry.options.ignoreFromSelf ) { +async function filterMatchesForOrigin(changeSets, entry) { + if (!entry.options || !entry.options.ignoreFromSelf) { return changeSets; } else { - const originIpAddress = await getServiceIp( entry ); - return changeSets.filter( (changeSet) => changeSet.origin != originIpAddress ); + const originIpAddress = await getServiceIp(entry); + return changeSets.filter((changeSet) => changeSet.origin != originIpAddress); } } -function hostnameForEntry( entry ) { +function hostnameForEntry(entry) { return (new URL(entry.callback.url)).hostname; } async function getServiceIp(entry) { - const hostName = hostnameForEntry( entry ); - return new Promise( (resolve, reject) => { - dns.lookup( hostName, { family: 4 }, ( err, address) => { - if( err ) - reject( err ); + const hostName = hostnameForEntry(entry); + return new Promise((resolve, reject) => { + dns.lookup(hostName, {family: 4}, (err, address) => { + if (err) + reject(err); else - resolve( address ); - } ); - } ); + resolve(address); + }); + }); }; diff --git a/lib/health.js b/lib/health.js new file mode 100644 index 0000000..68cb999 --- /dev/null +++ b/lib/health.js @@ -0,0 +1,26 @@ +import { app } from 'mu'; +import dayjs from 'dayjs'; + +const FAILURES = []; + +FAILURES.recent = function() { + const now = dayjs.now(); + return this.filter(failure => failure.date.diff(now, 'hours') <= 3); +}; + +app.get('/health', function(req, res) { + let recent = FAILURES.recent(); + if (recent.length) { + return res.status(500, { + status: 'FAILING', + failures: recent + }); + } + return res.status(200, { + status: 'UP' + }); +}); + +export { + FAILURES +}; \ No newline at end of file diff --git a/package.json b/package.json index 89a224e..65d3bd0 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ }, "homepage": "https://github.com/mu-semtech/delta-notifier#readme", "dependencies": { + "dayjs": "^1.10.5", "request": "^2.88.0" } } From bf5cedac04e531656e074307c61c9f0081b49a2d Mon Sep 17 00:00:00 2001 From: Dries Hugaerts Date: Thu, 27 May 2021 12:27:06 +0200 Subject: [PATCH 02/10] updated usage of dayjs. --- app.js | 2 +- lib/health.js | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app.js b/app.js index 9fc9f12..20b7861 100644 --- a/app.js +++ b/app.js @@ -93,7 +93,7 @@ async function informWatchers(changeSets, res, muCallIdTrail) { } catch (error) { FAILURES.push({ error, - date: dayjs.now() + date: dayjs() }); } } diff --git a/lib/health.js b/lib/health.js index 68cb999..39e07b6 100644 --- a/lib/health.js +++ b/lib/health.js @@ -4,19 +4,18 @@ import dayjs from 'dayjs'; const FAILURES = []; FAILURES.recent = function() { - const now = dayjs.now(); - return this.filter(failure => failure.date.diff(now, 'hours') <= 3); + return this.filter(failure => failure.date.diff(dayjs(), 'hours') <= 3); }; app.get('/health', function(req, res) { let recent = FAILURES.recent(); if (recent.length) { - return res.status(500, { + return res.status(500).send({ status: 'FAILING', failures: recent }); } - return res.status(200, { + return res.status(200).send({ status: 'UP' }); }); From e0fba82d28b216460e38605a31b87f05c248a558 Mon Sep 17 00:00:00 2001 From: Dries Hugaerts Date: Fri, 28 May 2021 12:53:21 +0200 Subject: [PATCH 03/10] added metrics.js to keep track off passed delta's; if they failed or not. Updated endpoint to /metric --- app.js | 37 ++++++++++++++++-------- lib/health.js | 25 ---------------- lib/metrics.js | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+), 37 deletions(-) delete mode 100644 lib/health.js create mode 100644 lib/metrics.js diff --git a/app.js b/app.js index 20b7861..44b0c2e 100644 --- a/app.js +++ b/app.js @@ -3,8 +3,7 @@ import request from 'request'; import services from '/config/rules.js'; import bodyParser from 'body-parser'; import dns from 'dns'; -import { FAILURES } from './lib/health'; -import dayjs from 'dayjs'; +import metrics from './lib/metrics'; // Also parse application/json as json app.use(bodyParser.json({ @@ -23,6 +22,10 @@ app.get('/', function(req, res) { res.send('Hello, delta notification is running'); }); +app.get('/metric', function(req, res) { + res.status(200).send(metrics.getReport()); +}); + app.post('/', function(req, res) { if (process.env['LOG_REQUESTS']) { console.log('Logging request body'); @@ -48,8 +51,9 @@ app.post('/', function(req, res) { }); async function informWatchers(changeSets, res, muCallIdTrail) { - try { - services.map(async (entry) => { + + services.map(async (entry) => { + try { // for each entity if (process.env['DEBUG_DELTA_MATCH']) console.log(`Checking if we want to send to ${entry.callback.url}`); @@ -89,13 +93,14 @@ async function informWatchers(changeSets, res, muCallIdTrail) { sendRequest(entry, originFilteredChangeSets, muCallIdTrail); } } - }); - } catch (error) { - FAILURES.push({ - error, - date: dayjs() - }); - } + } catch (error) { + metrics.addRequest({ + url: entry.callback.url, + method: entry.callback.method, + error + }); + } + }); } function tripleMatchesSpec(triple, matchSpec) { @@ -186,10 +191,18 @@ async function sendRequest(entry, changeSets, muCallIdTrail) { console.log(`Could not send request ${method} ${url}`); console.log(error); console.log(`NOT RETRYING`); // TODO: retry a few times when delta's fail to send + metrics.addRequest({ + url, + method, + error + }); } if (response) { - // console.log( body ); + metrics.addRequest({ + url, + method + }); } }); } diff --git a/lib/health.js b/lib/health.js deleted file mode 100644 index 39e07b6..0000000 --- a/lib/health.js +++ /dev/null @@ -1,25 +0,0 @@ -import { app } from 'mu'; -import dayjs from 'dayjs'; - -const FAILURES = []; - -FAILURES.recent = function() { - return this.filter(failure => failure.date.diff(dayjs(), 'hours') <= 3); -}; - -app.get('/health', function(req, res) { - let recent = FAILURES.recent(); - if (recent.length) { - return res.status(500).send({ - status: 'FAILING', - failures: recent - }); - } - return res.status(200).send({ - status: 'UP' - }); -}); - -export { - FAILURES -}; \ No newline at end of file diff --git a/lib/metrics.js b/lib/metrics.js new file mode 100644 index 0000000..67513a5 --- /dev/null +++ b/lib/metrics.js @@ -0,0 +1,77 @@ +import dayjs from 'dayjs'; + +class Metrics { + + constructor() { + this._requests = []; + + // NOTE: set interval to clean up request metrics every hour + const now = dayjs(); + const nextHour = now.hour(now.hour() + 1).minute(0).second(0).millisecond(0); + setTimeout(() => { + this.collectGarbage(); + setInterval(this.collectGarbage.bind(this), 1000 * 60 * 60); + }, nextHour.diff(now, 's')); + } + + get requests() { + const response = this.getLastRequests(3, 'h'); + response['failed'] = response.filter(request => !!request.error); + return response; + } + + collectGarbage() { + console.log('Collecting garbage ...'); + console.log(this._requests); + // NOTE: we slice to remove any unwanted meta-data (clean-copy) + this._requests = this.requests.slice(); + console.log('Done'); + console.log(this._requests); + } + + addRequest(request) { + request['time'] = dayjs(); + this._requests.push(request); + } + + getLastRequests(time = 1, unit = 'minute') { + return this._requests.filter(value => dayjs().diff(value.time, unit) <= time); + } + + getReport() { + const report = { + failed: { + amount: 0 + } + }; + + console.log(this.requests); + console.log(this._requests); + report['total'] = this.requests.length; + report.failed.amount = this.requests.failed.length; + + const helper = {}; + report.failed.requests = this.requests.failed.reduce((result, request) => { + const key = `${request.url}-${request.method}`; + if (!helper[key]) { + helper[key] = Object.assign({}, { + url: request.url, + method: request.method, + amount: 1 + }); + result.push(helper[key]); + } else { + helper[key].amount++; + } + return result; + }, []); + + return report; + } + +} + +const metric = new Metrics(); + +// NOTE: we only expose a singleton for service wide use. +export default metric; \ No newline at end of file From 0fbb839124579afa731e86df7defc819bdd52b4d Mon Sep 17 00:00:00 2001 From: Dries Hugaerts Date: Fri, 28 May 2021 14:07:23 +0200 Subject: [PATCH 04/10] Gave metric report properties more self explanatory --- lib/metrics.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/metrics.js b/lib/metrics.js index 67513a5..bbd60f3 100644 --- a/lib/metrics.js +++ b/lib/metrics.js @@ -40,28 +40,29 @@ class Metrics { getReport() { const report = { - failed: { - amount: 0 + failed_delta_delivery: { + count: 0 } }; console.log(this.requests); console.log(this._requests); - report['total'] = this.requests.length; - report.failed.amount = this.requests.failed.length; + report['delta_requests_total'] = this.requests.length; + report.failed_delta_delivery.count = this.requests.failed.length; const helper = {}; - report.failed.requests = this.requests.failed.reduce((result, request) => { + report.failed_delta_delivery.requests = this.requests.failed.reduce((result, request) => { const key = `${request.url}-${request.method}`; if (!helper[key]) { helper[key] = Object.assign({}, { url: request.url, method: request.method, - amount: 1 + count: 1 }); result.push(helper[key]); } else { helper[key].amount++; + helper[key].amount++; } return result; }, []); From 3c8db0fa7b2a894e2ca0094814930c9ca905f878 Mon Sep 17 00:00:00 2001 From: Dries Hugaerts Date: Fri, 28 May 2021 14:09:30 +0200 Subject: [PATCH 05/10] Fixed request count. --- lib/metrics.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/metrics.js b/lib/metrics.js index bbd60f3..dedb6c2 100644 --- a/lib/metrics.js +++ b/lib/metrics.js @@ -61,8 +61,7 @@ class Metrics { }); result.push(helper[key]); } else { - helper[key].amount++; - helper[key].amount++; + helper[key].count++; } return result; }, []); From 749dc71b5faa173cb0a9c61ef1c350ed019f6164 Mon Sep 17 00:00:00 2001 From: Dries Hugaerts Date: Fri, 28 May 2021 14:10:24 +0200 Subject: [PATCH 06/10] Rename. --- lib/metrics.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/metrics.js b/lib/metrics.js index dedb6c2..9b3296e 100644 --- a/lib/metrics.js +++ b/lib/metrics.js @@ -40,7 +40,7 @@ class Metrics { getReport() { const report = { - failed_delta_delivery: { + delta_delivery_failed: { count: 0 } }; @@ -48,10 +48,10 @@ class Metrics { console.log(this.requests); console.log(this._requests); report['delta_requests_total'] = this.requests.length; - report.failed_delta_delivery.count = this.requests.failed.length; + report.delta_delivery_failed.count = this.requests.failed.length; const helper = {}; - report.failed_delta_delivery.requests = this.requests.failed.reduce((result, request) => { + report.delta_delivery_failed.requests = this.requests.failed.reduce((result, request) => { const key = `${request.url}-${request.method}`; if (!helper[key]) { helper[key] = Object.assign({}, { From 0717c083628e86d4bd8c884f414774c17d3e923c Mon Sep 17 00:00:00 2001 From: Dries Hugaerts Date: Fri, 28 May 2021 15:14:17 +0200 Subject: [PATCH 07/10] removed logs. --- lib/metrics.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/metrics.js b/lib/metrics.js index 9b3296e..67178cf 100644 --- a/lib/metrics.js +++ b/lib/metrics.js @@ -21,12 +21,8 @@ class Metrics { } collectGarbage() { - console.log('Collecting garbage ...'); - console.log(this._requests); // NOTE: we slice to remove any unwanted meta-data (clean-copy) this._requests = this.requests.slice(); - console.log('Done'); - console.log(this._requests); } addRequest(request) { From 57ead7d878f589aac04a79e04d5bf42e704863df Mon Sep 17 00:00:00 2001 From: Dries Hugaerts Date: Mon, 7 Jun 2021 13:56:56 +0200 Subject: [PATCH 08/10] small metric name change. --- lib/metrics.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/metrics.js b/lib/metrics.js index 67178cf..b9005e8 100644 --- a/lib/metrics.js +++ b/lib/metrics.js @@ -1,5 +1,9 @@ import dayjs from 'dayjs'; + +const TIME = parseInt(process.env['METRICS_KEEP_DELTAS_LAST_TIME']) || 3; +const UNITE = process.env['METRICS_KEEP_DELTAS_LAST_UNITE'] || 'h'; + class Metrics { constructor() { @@ -15,7 +19,7 @@ class Metrics { } get requests() { - const response = this.getLastRequests(3, 'h'); + const response = this.getLastRequests(TIME, UNITE); response['failed'] = response.filter(request => !!request.error); return response; } @@ -30,7 +34,7 @@ class Metrics { this._requests.push(request); } - getLastRequests(time = 1, unit = 'minute') { + getLastRequests(time = 1, unit = 'm') { return this._requests.filter(value => dayjs().diff(value.time, unit) <= time); } @@ -43,7 +47,7 @@ class Metrics { console.log(this.requests); console.log(this._requests); - report['delta_requests_total'] = this.requests.length; + report['deltas_total'] = this.requests.length; report.delta_delivery_failed.count = this.requests.failed.length; const helper = {}; From de8a5fc043d375c30c11d88116fd20e527bc6298 Mon Sep 17 00:00:00 2001 From: Dries Hugaerts Date: Mon, 7 Jun 2021 13:57:24 +0200 Subject: [PATCH 09/10] remove console logs. --- lib/metrics.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/metrics.js b/lib/metrics.js index b9005e8..5749967 100644 --- a/lib/metrics.js +++ b/lib/metrics.js @@ -45,8 +45,6 @@ class Metrics { } }; - console.log(this.requests); - console.log(this._requests); report['deltas_total'] = this.requests.length; report.delta_delivery_failed.count = this.requests.failed.length; From aaf40421279ba80e7e49a0434a4544f64cd42781 Mon Sep 17 00:00:00 2001 From: Dries Hugaerts Date: Tue, 8 Jun 2021 09:16:28 +0200 Subject: [PATCH 10/10] metric name change. --- lib/metrics.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/metrics.js b/lib/metrics.js index 5749967..7a87b71 100644 --- a/lib/metrics.js +++ b/lib/metrics.js @@ -45,7 +45,7 @@ class Metrics { } }; - report['deltas_total'] = this.requests.length; + report['delta_delivery_total'] = this.requests.length; report.delta_delivery_failed.count = this.requests.failed.length; const helper = {};