Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket.on doesn't work well with newrelic #541

Closed
shai32 opened this issue Nov 6, 2017 · 1 comment
Closed

socket.on doesn't work well with newrelic #541

shai32 opened this issue Nov 6, 2017 · 1 comment

Comments

@shai32
Copy link

shai32 commented Nov 6, 2017

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

darrachequesne added a commit that referenced this issue May 8, 2020
@darrachequesne
Copy link
Member

Closed due to inactivity, please reopen if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants