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: Performance monitoring for NodeJS GraphQL application

performance
feature-idea
rfb
graphql

#1

How can I gain more granular monitoring of my GraphQL NodeJS application?

We have written an NodeJS application that is using Apollo GraphQL server. We are running this app inside of a Docker container, and monitoring the application with New Relic APM NodeJS agent.

I am expecting to see more granular information about each GraphQL resolver, but APM is only displaying information at the top level endpoint (/graphql). This is not very helpful since there is a lot of logic in each resolver that I would like to monitor.

I assume there are ways to add custom NR instrumentation to my code with the NR NodeJS SDK, but I was hoping to get more monitoring out of the box for free (i.e. without instrumentation).

Apollo offers a product called Apollo Engine. This is a specialized solution for Apollo, and I am hoping to stay inside the NR ecosystem, as opposed to adding a separate monitoring solution.

It seems like GraphQL has gained significant adoption. (Netflix, Facebook, Atlassian, Contentful, Github, New Relic) I am surprised that New Relic has not added features specific for GraphQL to APM.

What options does New Relic APM offer for more granular monitoring of GraphQL?


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

Hi there @dmiyamasu,

You’re correct - the answer here is definitely to make use of custom instrumentation:

I want to assure you that using the Custom Instrumentation is free money-wise (it makes use of our API) but it does require some extra work upfront. The reason for this is that one of the limitations of our agent is that we can only safely instrument a method we recognize as part of a known framework, i.e. methods that we have written instrumentation for. So, if your application is using an “unsupported” framework, you’ll almost certainly need to perform custom instrumentation to surface the transactions that you’re interested in. Custom instrumentation is just a way of extending the list of items that the agent recognizes out-of-the-box. Currently, we do not have any specific written instrumentation for Apollo or GraphQL. You can see the list of everything that we do currently instrument out of the box on our compatibility and requirements doc:


#3

@dmiyamasu - Thanks for sharing such a thorough use case with us. I want to be sure that the Node.js team sees your needs so I have passed along this post! Some of what you mentioned is not available out of the box. @palleman’s suggestion will get you far, and I have also created a Feature Request on your behalf to be sure your needs are heard by the broader New Relic team. :blush:

I have also added a poll above so that others in the community can vote on seeing more of the granular data you mentioned above. Thanks again and don’t forget to vote!


#4

Thank you @Linds & @palleman!

I am curious if you have contacts on the New Relic team who owns the New Relic GraphQL API? I’d love to hear how they chose to monitor their GraphQL application with New Relic APM.


#5

@mweitzel
Any input on this? I thought you might have some thoughts based on this article: https://blog.newrelic.com/engineering/graphql-api/


#6

Hi, @dmiyamasu: @mweitzel and his team have been busy these past few months working on the New Relic programmability platform. He is in NYC this week, unveiling the platform at our FutureStack conference. Hopefully he will be able to help when he returns. Thanks for your patience!


#7

Thanks @philweber
If @mweitzel is not the right person to contact on the NR GraphQL team, can you point me to someone else who may be able to share NR learnings on monitoring the NR GraphQL API?


#8

He is the right person, he is just busy with new product launches at the moment. I am sure he will help as soon as he can.


#9

Hi all,
is there any chance the agent will include GraphQL instrumentation OOB anytime soon?
Is there any example of custom instrumentation for GraphQL?


#10

@dmiyamasu - I spoke with our GraphQL team who mentioned that they have instrumented GraphQL with Elixir, and our open source Elixir agent. Not via Apollo & Node.

@paolo.bianchi - I’m unsure of timelines - but the feature idea to have GraphQL instrumented out of the box is there - we’ll keep this thread up to date on any progress with that


#11

For folks using Apollo-Graphql. Apollo provides ability to use plugins as a way to log information about lifecycles.

https://deploy-preview-2008–apollo-server-docs.netlify.com/docs/apollo-server/integrations/plugins/#plugin-event-reference

We can add a custom plugin to rename the transaction that newrelic creates.

const newRelicPlugin = {
requestDidStart(requestContext) {
return {
executionDidStart(rc) {
newrelic.setTransactionName(rc.request.operationName);
},
didEncounterErrors(rc) {
newrelic.noticeError(rc.errors[0].message);
},
willSendResponse(rc) {
console.log(rc.request.operationName);
}
};
}
};

then add plugins: [newRelicPlugin] to apollo server config. This will name your transaction correctly to the query/mutation being executed.


#12

This is great! Thanks for sharing that solution @Ishpreet.Damir :smiley:


#13

I’d like to “up vote” @paolo.bianchi ask about more GQL support OOB.
We’re currently beating our heads against the wall. NR is telling us we’ve got some Transactions that are horribly slow. But we have no visibility into the details… I can’t drill down into the specifics of the GQL requests that are slow


#14

https://deploy-preview-2008apollo-server-docs.netlify.com/docs/apollo-server/integrations/plugins/#plugin-event-reference … That link doesn’t appear to work


#15

Hey @ethiele - thanks for posting - I’ve added your +1 to a feature idea for native GQL support here. :slight_smile: