[Java] Reporting based on API Endpoints instead of AkkaHandler

We have started using New Relic to track/handle a number of the services we have deployed using Lagom. App is all written in Scala. Lagom, under the covers, is written on top of Play and Akka. The issue that we are having is that what reports to New Relic is simply “/akkaHandler” which is not super useful. We would like to be able to track the actual endpoints that the akkaHandler is processing - for example the specific URI for login : “/v1/customer/login”. The docs for the scala instrumentation are pretty limited:
https://docs.newrelic.com/docs/agents/java-agent/frameworks/scala-installation-java

Before we go through the effort of adding NewRelic.setTransactionName(null, "/myTransaction"); to each of the few hundred endpoints we have I wanted to check and see if this is the best/only way to go about this. Has anyone dealt with this before?

Hello @gordon.cooke,

Good question! We see that from time to time, and the answer is that it depends. First, I would start with making sure your version of Akka and other services are supported. For instance, based on the Compatibility Requirements Java Agent - Auto Instrumented we support Akka 2.2.0-RC1 to latest.

What Akka, Scala and Play versions are you using? Using a supported version is usually the difference between having good visibility to the transactions and not. The reason is that supported versions have built in instrumentation.

Another way to double check is to look in our Java Agent OS Github - Instrumentation. You can scroll through and look for the versions you are using, then confirm if our build is checking for it.

Additionally, I would check the Java agent versions you are running. If your agents are out of date, they may be missing Instrumentation that was added in a later version. A quick way to do this is to run a NRQL query for agent version:

SELECT count(*) FROM NrDailyUsage where usageType = 'Application'
and productLine = 'APM'
and apmLanguage like 'java' 
since 1 day ago
facet apmAppId, apmAppName, apmAgentVersion, hostId, agentHostname, 
apmAppInstanceId limit 1000

Or use this nifty Nerdlet - Agent Groundskeeper which allows you to see the latest agent versions, compared to the versions currently running in your account.

I hope that helps!

We are using Lagom 1.6 which is backed by Play 2.8 and Akka 2.6, both of which are in the “supported” matrix. I am guessing that there is a gap in the way Lagom handles the routes and how that maps to the way that Play handles them that the auto-instrumentation fails and we end up with just /akkaHandler. We are running the 6.1.0 Java agent - will try upgrading that to 6.2.0 and see if that makes a difference. This is all compiled using Scala 2.12