newrelic / newrelic-java-agent

The New Relic Java agent
Apache License 2.0
199 stars 143 forks source link

Transaction starting as child of com.newrelic.agent.tracers.OtherRootTracer@2d1f60da instead of as Parent #2087

Open patrickjamesbarry opened 21 hours ago

patrickjamesbarry commented 21 hours ago

Description

Token is reporting parent as com.newrelic.agent.tracers.OtherRootTracer@172e5a3c when it should be the first/root.parent

Expected Behavior

I would expect the very first Token created on Transaction, would be the root/parent OR the token parent would be the transaction. However in our app, the trace logging we see seems to show @Trace(dispatcher=true) is not behaving the way we thought it would.

Troubleshooting or [NR Diag]

024-10-02T17:05:08,223-0400 [63093 57] com.newrelic FINE: create Transaction com.newrelic.agent.Transaction@7166d8fe 2024-10-02T17:05:08,223-0400 [63093 57] com.newrelic FINE: created com.newrelic.agent.TransactionActivity@0 for com.newrelic.agent.Transaction@7166d8fe 2024-10-02T17:05:08,259-0400 [63093 27] com.newrelic.jar_collector FINE: /org/glassfish/hk2/osgi-resource-locator/1.0.3/osgi-resource-locator-1.0.3.jar Adding the file osgi-resource-locator-1.0.3.jar with version 1.0.3. 2024-10-02T17:05:08,264-0400 [63093 27] com.newrelic.jar_collector FINE: /org/glassfish/hk2/hk2-locator/3.0.6/hk2-locator-3.0.6.jar Adding the file hk2-locator-3.0.6.jar with version 3.0.6. 2024-10-02T17:05:08,267-0400 [63093 27] com.newrelic.jar_collector FINE: /org/glassfish/hk2/hk2-utils/3.0.6/hk2-utils-3.0.6.jar Adding the file hk2-utils-3.0.6.jar with version 3.0.6. 2024-10-02T17:05:08,325-0400 [63093 27] com.newrelic.jar_collector FINE: /org/glassfish/jersey/containers/jersey-container-servlet/3.1.8/jersey-container-servlet-3.1.8.jar Adding the file jersey-container-servlet-3.1.8.jar with version 3.1.8. 2024-10-02T17:05:08,356-0400 [63093 27] com.newrelic.jar_collector FINE: /org/glassfish/jersey/core/jersey-client/3.1.8/jersey-client-3.1.8.jar Adding the file jersey-client-3.1.8.jar with version 3.1.8. 2024-10-02T17:05:08,374-0400 [63093 27] com.newrelic.jar_collector FINE: /org/glassfish/jersey/ext/jersey-bean-validation/3.1.8/jersey-bean-validation-3.1.8.jar Adding the file jersey-bean-validation-3.1.8.jar with version 3.1.8. 2024-10-02T17:05:08,381-0400 [63093 27] com.newrelic.jar_collector FINE: /org/glassfish/jersey/ext/jersey-entity-filtering/3.1.8/jersey-entity-filtering-3.1.8.jar Adding the file jersey-entity-filtering-3.1.8.jar with version 3.1.8. 2024-10-02T17:05:08.390-04:00 WARN 63093 --- [nio-8080-exec-1] o.g.jersey.server.wadl.WadlFeature : JAXBContext implementation could not be found. WADL feature is disabled. 2024-10-02T17:05:08,437-0400 [63093 27] com.newrelic.jar_collector FINE: /org/glassfish/hk2/spring-bridge/3.0.6/spring-bridge-3.0.6.jar Adding the file spring-bridge-3.0.6.jar with version 3.0.6. 2024-10-02T17:05:08.487-04:00 INFO 63093 --- [nio-8080-exec-1] c.e.N.MyApplicationListener : Application was initialized. 2024-10-02T17:05:08,488-0400 [63093 57] com.newrelic FINE: com.newrelic.instrumentation.servlet-6.0: weaved target jdk.internal.loader.ClassLoaders$AppClassLoader@1dbd16a6-org/apache/catalina/connector/ResponseFacade 2024-10-02T17:05:08,488-0400 [63093 57] com.newrelic FINE: jakarta/servlet/http/HttpServletResponse.setStatus:(I)V 2024-10-02T17:05:08,488-0400 [63093 57] com.newrelic FINE: jakarta/servlet/http/HttpServletResponse.sendError:(I)V 2024-10-02T17:05:08,488-0400 [63093 57] com.newrelic FINE: jakarta/servlet/http/HttpServletResponse.:(Lorg/apache/catalina/connector/Response;)V 2024-10-02T17:05:08,500-0400 [63093 57] com.newrelic DEBUG: Instrumenting class com/example/NewRelicTransactionProblem/MyRequestListener 2024-10-02T17:05:08,500-0400 [63093 57] com.newrelic FINE: Instrumented com.example.NewRelicTransactionProblem.MyRequestListener.matchingStartEvent(Lorg/glassfish/jersey/server/monitoring/RequestEvent;)V, [TraceAnnotation], [MyRequestListener.java] Token created: parent:com.newrelic.agent.tracers.OtherRootTracer@172e5a3c 2024-10-02T17:05:08.526-04:00 INFO 63093 --- [nio-8080-exec-1] c.e.N.MyRequestListener : > Start ASYNC: []

Steps to Reproduce

Here is a branch in my github demonstrating problem https://github.com/patrickjamesbarry/newrelic/tree/TransActionNotParent

Build project with maven, jdk 17 NewRelicTransactionProblemApplication.java is the main class It stands up a springboot project and you can hit the endpoint using jvm args: -javaagent:<path-to-newrelic>/newrelic/newrelic.jar

curl http://localhost:8080/test

Your Environment

We are a Springboot/Jersey Rest service.
NewRelic Java Agent 8.11.1 Spring Framework 6.1.13 Springboot 3.3.0 Jersey 3.1.7 Tomcat 10.1.25 JDK 17 OpenJDK 64-Bit Server VM

Additional context

We use Jersey's RequestEventListener as an entry point into our app. MyApplicationListener -> MyRequestListener -> Resource

workato-integration[bot] commented 21 hours ago

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