newrelic-java-agent icon indicating copy to clipboard operation
newrelic-java-agent copied to clipboard

Transaction loss for async GraphQL request

Open monu-k2io opened this issue 2 years ago • 1 comments

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

monu-k2io avatar Dec 07 '23 04:12 monu-k2io

https://new-relic.atlassian.net/browse/NR-187223