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?
Asked
Active
Viewed 426 times
3

Mark Rotteveel
- 100,966
- 191
- 140
- 197

Michael George
- 647
- 9
- 15
-
@Micheal Have you got this answer? actually I have same question didn't get any solution also for the Node application with graphQL – Rahul Saini Jan 17 '22 at 06: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. – Todd W Crone Mar 02 '22 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. – Todd W Crone Mar 02 '22 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. – Todd W Crone Mar 02 '22 at 15:41
2 Answers
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.

André Onuki
- 428
- 2
- 12
0

Oscar Jiang
- 305
- 3
- 8
-
How would that be, can you show a code example. Are these not different http endpoints. – Michael George Feb 24 '21 at 08:17
-
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() { } } ` – Oscar Jiang Mar 01 '21 at 15:32