Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mgartner/newrelic-hapi-url-bug
https://github.com/mgartner/newrelic-hapi-url-bug
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/mgartner/newrelic-hapi-url-bug
- Owner: mgartner
- Created: 2016-01-25T02:30:41.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-02-10T21:18:11.000Z (almost 9 years ago)
- Last Synced: 2024-10-12T02:46:18.916Z (about 1 month ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# newrelic-hapi-url-bug
This project reproduces 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 being handled by the server.
To replicate the bug, follow the instructions below.
Use Node v5 and install the dependencies:
```
nvm use 5
npm i
```Edit the node-newrelic module to print out the logged transaction URL. This will allow you to see when the logged transaction is incorrect.
In the file `node_modules/newrelic/lib/transaction/index.js` edit the `Transaction.prototype.setName` function to include a `console.log` at the end:
```js
Transaction.prototype.setName = function setName(requestURL, statusCode) {// ...
console.log('this.name:', this.name);
};
```Start the server.
```
node server.js
```Run the client.
```
node client.js
```Notice the transaction URLs printed in the `node server.js` output. Some of them are correctly reported as `WebTransaction/Hapi/GET//hello`, but most of them are incorrectly reported as `WebTransaction/NormalizedUri/*`.