-
Notifications
You must be signed in to change notification settings - Fork 565
Description
You want to:
report a bug
Current behaviour
socket.on doesn't work well with newrelic
I’m using engine.io to open a web socket between the client and the server on my app.
When a new ‘message’ arrives to the server, I add a custom newrelic.startWebTransaction
to monitor the time it takes my server to response to the message.
The problem is that I get incorrect “duration” reporting to New Relic (a web-transaction that takes 4000 mili-seconds is reported as 10 mili-seconds transaction)
I noticed that this problem occurs only inside my web-socket callback (it works fine in other places).
Here is a sample of my code that reports correct duration data to new-relic:
// this line is reported to new relic with the correct duration of 1000ms
newrelic.startWebTransaction(‘test 1 second’, () =>
new Promise(resolve => setTimeout(resolve, 1000)));
socket.on(‘message’, (str) => {
// this line is reported to new relic with the incorrect duration of only few ms;
newrelic.startWebTransaction(‘test 2 second’, () =>
new Promise(resolve => setTimeout(resolve, 2000)));
})
I am using:
node 6.10.3
newrelic 2.3.2
engine.io 3.1.3