Auto-instrumentation won't work for the Akka framework. You must manually instrument transactions using our custom API's instrumentation. Please follow the steps below
Add Agent API dependency
Option 1: Using Jar
If you are using a JAR file, you can download the Atatus Agent API jar from Maven Central and place it in your class path.
Option 2: Using pom.xml
Add dependency to your pom.xml file as follows.
<dependency>
<groupId>com.atatus.apm</groupId>
<artifactId>atatus-agent-api</artifactId>
<version>2.0.0</version>
</dependency>
Instrumentation
Create transaction and set the name at the start of the route method as follows
import com.atatus.apm.api.Atatus; val transaction = Atatus.startTransaction() transaction.setName("/register")
After processing the request, end the transaction before sending the response.
.map((result) => { transaction.end() result })
Example
import com.atatus.apm.api.Atatus;
def register: Action[UserRegistrationWrapper] = Action.async(validateJson[UserRegistrationWrapper]) { request =>
// Code to be added - Begin and set transaction like below.
val transaction = Atatus.startTransaction()
transaction.setName("Register user")
actionRunner.runTransactionally(userRegistrationService.register(request.body.user))
.map(user => {
val jwtToken: JwtToken = generateToken(user.securityUserId)
UserDetailsWithToken(user.email, user.username, user.createdAt, user.updatedAt, user.bio, user.image,
jwtToken.token)
})
.map(UserDetailsWithTokenWrapper(_))
.map((result) => {
Json.toJson(result)
})
.map((result) => {
// Code to be added - End transaction
transaction.end()
result
})
.map((result) => {
Ok(result)
})
.recover(handleFailedValidation)
}