1.0.0 • Published 8 years ago
hapi-new-relic-transaction-patch v1.0.0
hapi-new-relic-transaction-patch
Note
NewRelic fixed the issue in node-newrelic v1.25.5. This patch is no longer relevant.
This Hapi plugin fixes a bug in node-newrelic that incorrectly reports transactions with URLs of /*. This bug occurs when a request extension (onPostAuth, onPreresponse, etc.) calls request.reply() within a promise chain, and concurrent requests are begin handled by the server.
There is an example application that reproduces this bug here: https://github.com/mgartner/newrelic-hapi-url-bug
This plugin works by calling NewRelic.setTransactionName()
in a onPostAuth
hook. The name is formatted to show correctly in New Relic's Dashboard with the HTTP method and route path.
Installation
npm i hapi-new-relic-transaction-patch
Registering the Plugin
const Hapi = require('hapi');
let server = Hapi.Server();
server.register([
require('hapi-new-relic-transaction-patch')
], () => {
console.log('error:', err);
});
1.0.0
8 years ago