3

I have a Java Spring Boot service exposing GraphQL API. NewRelic identify all the queries as configuredGraphQLHttpServlet Web transaction as all of them are exposed via a single /graphql API . How can we track each GraphQL query resolver as different web transactions?

4
  • @Micheal Have you got this answer? actually I have same question didn't get any solution also for the Node application with graphQL Commented Jan 17, 2022 at 6:38
  • Node is a little different. I'll see if I can find documentation but I think André is going to post a link to some hopefully helpful documentation for the Java version soon. Commented Mar 2, 2022 at 15:39
  • @RahulSaini perhaps it might make sense to ask a similar question with Node tags etc. if possible so its easier to find. Commented Mar 2, 2022 at 15:40
  • Tag me or whatever on the Node question and I'll get someone from the Node team to answer or I'll find the information and and answer for you. Commented Mar 2, 2022 at 15:41

2 Answers 2

2

The New Relic Java agent starting with version 7.4.0 (Oct 2021) has auto-instrumentation for GraphQL. Use 7.4.3 or higher though.

With it the transactions are going to be named based on the query.

Check the documentation.

Sign up to request clarification or add additional context in comments.

Comments

0

You can use an AOP to set transaction name base on graphql method. It will look like below.

enter image description here

2 Comments

How would that be, can you show a code example. Are these not different http endpoints.
You can try like this. Hope it might help :) ` @Aspect @Component public class NewRelicGraphQLAspect { @After("isGraphQLRequest()") public void doSecurityCheck(JoinPoint point) { String methodName = point.getSignature().getName(); NewRelic.setTransactionName("GraphQL", methodName); } @Pointcut("within(com.example.server.graphql.resolver..*)") private void isGraphQLRequest() { } } `

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.