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?
-
@Micheal Have you got this answer? actually I have same question didn't get any solution also for the Node application with graphQLRahul Saini– Rahul Saini2022-01-17 06:38:01 +00:00Commented 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.Todd W Crone– Todd W Crone2022-03-02 15:39:38 +00:00Commented 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.Todd W Crone– Todd W Crone2022-03-02 15:40:33 +00:00Commented 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.Todd W Crone– Todd W Crone2022-03-02 15:41:46 +00:00Commented Mar 2, 2022 at 15:41
Add a comment
|
2 Answers
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.
Comments
2 Comments
Michael George
How would that be, can you show a code example. Are these not different http endpoints.
Oscar Jiang
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() { } } `
