Java APM Setup
Traces | Metrics | App Logs | Custom Logs | Profiling |
---|---|---|---|---|
Prerequisites
- To monitor APM data on dashboard, Middleware Host agent needs to be installed.
- You can refer this demo project to refer use cases of APM.
Distributed Tracing
For recording the traces you will need to download JAR files given below. middleware-javaagent-1.3.0.jar
And then run your project with command given below
Clojure/Ring Demo
https://github.com/middleware-labs/demo-apm/tree/master/java/ring-demo
Add custom logs
Add this dependency in pom.xml
Note:
Refer the latest APM version from the link given below: https://central.sonatype.com/artifact/io.github.middleware-labs/agent-apm-java/0.0.17/versions
Then run
Import logger package
Use these functions for logging with different severity levels
Note for APM inside Kubernetes
If you are using APM in a Kubernetes cluster make sure to follow these 2 steps:
Step 1 : Find your Middleware Service namespace
For older setup, your “mw-service” can be inside mw-agent-ns-{FIRST-5-LETTERS-OF-API-KEY}
namespace
For newer setup, we simplified the namespace name to mw-agent-ns
Step 2 : Set this ENV variable in your application deployment YAML
Error Handling
If you want to record exception in traces then you can use Logger.recordError(e) method.