Newrelic + node.js + socket.io

旧城冷巷雨未停 提交于 2020-01-03 05:13:09

问题


Newrelic announced support for node.js applications on Oct 24, 2013.

I set up monitoring for my node.js server. It is a service that talks to Client via socket.io. Now, all the requests like this /socket.io/*/xhr-polling/40pt1SBvasfDuwctz4Ma for the service appear to take 20.000 seconds.

Is there a way to set up newrelic so it would correctly show request times served by socket.io?


回答1:


New Relic gives you the option to ignore a rule for something exactly like this. For example you would want to add something like the following:

// newrelic.js
exports.config = {
  // other configuration
  rules : {
    ignore : [
      '^/socket.io/.*/xhr-polling/.*'
    ]
  }
};

There is also an API call that you can use to programmatically do this. You can find more about this in the node.js agent github README.md




回答2:


The software is actually working as intended.

When using XHR-polling with Socket.IO, the default polling duration is 20 seconds. Therefore, the connection is held open for 20 seconds, which is the reason why New Relic reports it as so.



来源:https://stackoverflow.com/questions/19591611/newrelic-node-js-socket-io

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!