GraphQL Query resolvers as separate Web transactions

Viewed 281

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?

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.

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

enter image description here

Related