Your data. Anywhere you go.

New Relic for iOS or Android


Download on the App Store    Android App on Google play


New Relic Insights App for iOS


Download on the App Store


Learn more

Close icon

Feature Idea: APM With Feathersjs With Socket.io

feature-idea

#1

Please paste the [permalink][1] to the page in question below:

Reporting to: https://rpm.newrelic.com/accounts/1347530/applications/19015455

Please share your agent version and other relevant versions below:

Agent version: 1.34.0; Node version: v5.12.0

Please share your question/describe your issue below. Include any screenshots that may help us understand your question:

First, our server is implemented using Feathersjs, which helps you build REST interfaces and uses socket.io. I mention this because I think it’s the problem.

I’m evaluating New Relic for our product for a paid service, and it looks like the automatic instrumentation doesn’t work. I’m not seeing calls other than for static resources and for /. I decided to add custom parameters, and got this message:

{“v”:0,“level”:40,“name”:“newrelic”,“hostname”:“Shawns-MacBook-Pro.local”,“pid”:25312,“time”:“2017-01-11T00:00:30.951Z”,“msg”:“No transaction found for custom parameters.”,“component”:“api”}

So I looked through the documentation and found that probably New Relic is not automatically detecting our transactions, probably because we use socket.io. Unfortunately from what I can tell, the way to instrument web transactions is to wrap the handler into a function passed to New Relic, which New Relic calls.

However, feathersjs is setup to handle the all the calls on the backend in its platform (which extends express), so feathersjs calls ‘before’ hooks, then performs the resource operation (GET, POST, PATCH, etc), and then ‘after’ hooks. In fact the operation itself (typically accessing a resource from the database) is handled completely transparently by feathers.

So my question is if New Relic can handle this setup at all. If it can’t, we won’t be able to use New Relic. I look forward to any help anyone can provide.


New Relic edit

  • I want this, too
  • I have more info to share (reply below)
  • I have a solution for this

0 voters

We take feature ideas seriously and our product managers review every one when plotting their roadmaps. However, there is no guarantee this feature will be implemented. This post ensures the idea is put on the table and discussed though. So please vote and share your extra details with our team.


#2

@slauzon Thanks for posting to the forum. The Node agent began ignoring socket.io requests by default in agent version 1.33.0.

You are correct that in order to instrument socket.io requests, you’d need to use the createWebTransaction() and endTransaction() API calls (as described here). By default, the Node agent instruments web requests that use the request / response cycle. With websockets, you’d need to use the API calls to define the start and end of a “transaction”.

Looking at the permalink you provided, although I do see a lot of transactions being named /*, I do see several transactions that appear to be properly named. Please let us know if I’m mistaken.

The /* you’re seeing is most likely due to Feathers.js not being a supported web framework. In these cases, we typically recommend using the newrelic.setTransactionName() API call to properly name the transaction (more info here).

I’m not familiar with Feathers.js but if it doesn’t allow you to use the agent’s API calls, I’d be happy to create a feature request on your behalf for the Node agent to support this framework.

Let us know if you have any questions.


#3

Thanks for the response. After looking at this in more detail, we were forced to change our socket.io transactions to REST transactions. The reason is that createWebTransaction requires the handler to be passed to New Relic, however Feathers requires that it call each of the handlers. In Feathers you define before and after hooks, but Feathers calls each of them; it’s not a single handler. Thus, I could call endTransaction at the end of the call (as the final after hook), but I could see no way to call it within the handler which I pass to New Relic.

So yes, I would love to see a feature request to better support Feathers. Fortunately we don’t require socket.io at the moment, but it would be awesome to see that support in New Relic. Let me know if I can provide other information. Thank you!


#4

@slauzon Thanks for getting back to us. I’ll move forward with the feature request.


#5

Fantastic, thank you!