newrelic / newrelic/newrelic-java-agent
Transaction loss for async GraphQL request
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 240
- Forks
- 170
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 21
Description
We have identified an issue related to the Transaction loss for async GraphQL request.
Description
The Graphql async request was executed successfully and when we checked the transactions on the Newrelic UI, we did not see the transaction for Graphql but instead saw a different transaction for only servlet because the application is servlet-based.
When the same request was made synchronously and executed synchronously by the server we saw the following Graphql transaction on the Newrelic UI
WebTransaction/GraphQL/QUERY/<anonymous>/findAllBooks
When I was tracking the transaction I was able to track the transaction from the start of the request processing to the request completion but in between this, I was not able to track the transaction where the actual Graphql query execution occurred that is mentioned below
https://github.com/eh3rrera/graphql-java-spring-boot-example/blob/6e03098cd329a705ffd9e62211216034cee2ae4d/src/main/java/com/example/DemoGraphQL/resolver/Query.java#L19
Expected Behavior
After executing the above request it is expected to get the transaction for Graphql as well as the transaction of servlet for async request processing.
Steps to Reproduce
Application:
Please run the application with the APM agent by following the instructions given in READ.md file to start the application
(https://github.com/eh3rrera/graphql-java-spring-boot-example)
Start the application with the Newrelic APM agent with IAST disabled and the fire request:
curl 'http://localhost:8080/graphql' \
-H 'Accept: application/json' \
-H 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H 'Cookie: Idea-9d5d9977=7e3c0379-0f5b-4fb2-817e-947dd6f1bd14' \
-H 'Origin: http://localhost:8080/' \
-H 'Referer: http://localhost:8080/' \
-H 'Sec-Fetch-Dest: empty' \
-H 'Sec-Fetch-Mode: cors' \
-H 'Sec-Fetch-Site: same-origin' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36' \
-H 'sec-ch-ua: "Google Chrome";v="119", "Chromium";v="119", "Not?A_Brand";v="24"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
--data-raw '{"query":"{\n findAllBooks {\n title\n author {\n firstName\n lastName\n }\n }\n}","variables":null}' \
--compressed
Environment
MacOS: Sonoma version 14.0
Java: Azul Zulu version 11.0.18
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the graphql-java-spring-boot-example referenced in the issue, following its READ.md instructions to run it with the New Relic APM agent. Reproduce the async request with the provided curl command and compare it with synchronous execution, focusing on the resolver at src/main/java/com/example/DemoGraphQL/resolver/Query.java:19. Done means the async request reports both the GraphQL and servlet transactions in New Relic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, java
- Domain
- observability-sre
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100