From 72cab9f3d7fedeb50856113ee96abf6dc25fb7d4 Mon Sep 17 00:00:00 2001 From: mrickard Date: Wed, 30 Oct 2024 13:32:11 -0400 Subject: [PATCH] fix: Updated messaging example instrumentation file and agent version Signed-off-by: mrickard --- .../instrument-messages/instrumentation.js | 13 ++++++------- .../instrument-messages/package.json | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/custom-instrumentation/instrument-messages/instrumentation.js b/custom-instrumentation/instrument-messages/instrumentation.js index cf6d5e3..0229534 100644 --- a/custom-instrumentation/instrument-messages/instrumentation.js +++ b/custom-instrumentation/instrument-messages/instrumentation.js @@ -85,14 +85,13 @@ function instrumentNiftyMessages(shim, messages, moduleName) { shim.recordConsume(Client.prototype, 'getMessage', new shim.specs.MessageSpec({ destinationName: shim.FIRST, callback: shim.LAST, - after({ args }) { - const [err, msg] = args - if (msg) { + after({ result, error }) { + if (result) { console.log( - `[NEWRELIC] getMessage on queue ${msg.queueName} returned a message: '${msg.msg}'` + `[NEWRELIC] getMessage on queue ${result.queueName} returned a message: '${result.msg}'` ) // misc key/value parameters can be recorded as a part of the trace segment - const params = { message: msg.msg, queueName: msg.queueName } + const params = { message: result.msg, queueName: result.queueName } return { parameters: params @@ -101,7 +100,7 @@ function instrumentNiftyMessages(shim, messages, moduleName) { console.log('[NEWRELIC] getMessage returned no message') return { - parameters: { err } + parameters: { err: error } } } })) @@ -155,4 +154,4 @@ function instrumentNiftyMessages(shim, messages, moduleName) { parameters: params }) }) -} \ No newline at end of file +} diff --git a/custom-instrumentation/instrument-messages/package.json b/custom-instrumentation/instrument-messages/package.json index 5eee53d..96c1bd3 100644 --- a/custom-instrumentation/instrument-messages/package.json +++ b/custom-instrumentation/instrument-messages/package.json @@ -12,7 +12,7 @@ "license": "ISC", "dependencies": { "express": "^4.19.2", - "newrelic": "^12.0.0" + "newrelic": "^12.5.0" }, "devDependencies": { "@newrelic/eslint-config": "^0.2.0"