JVM
  • 14 Apr 2022
  • 1 Minute to read
  • PDF

JVM

  • PDF

Article Summary

You can install Traceable Java Agent in a Kubernetes environment. When you run the commands mentioned below, they automatically instrument any application in the namespace running in the JVM. Following is the compatibility matrix to make sure that you choose the right option.

Supported frameworks

Library/FrameworkVersions
Apache HttpAsyncClient4.1+
Apache HttpClient4.0+
gRPC1.6+
JAX-RS Client2.0+
Micronaut (basic support via Netty)1.0+
Netty4.0+
OkHttp3.0+
Servlet2.3+
Spark Web Framework2.3+
Spring Webflux5.0+
Vert.x3.0+
Struts2.3+

Install Java agent

Complete the following steps to install the Java agent. Make sure that you have identified the namespace in which you would like to auto inject the agent. 

  1. Enter the following command to label the namespace
    kubectl label namespace $NAMESPACE traceableai-inject-java=enabled
  2. Enter the following command to annotate the Java deployment
    kubectl patch deployment.apps/<JAVA_DEPLOYMENT> -p '{"spec": {"template": {"metadata": {"annotations": {"java.traceable.ai/inject": "true"}}}}}' -n <NAMESPACE>
    
  3. Restart the deployments in that namespace so that the Traceable platform agent can inject the Java agent into your deployment:
    ActionScript
    kubectl rollout restart deployment -n <NAMESPACE>

Verify

Check that the pods in the namespace have been injected with the Java agent by running the following command and verifying there is a traceable-javaagent-init initContainer.

kubectl describe pod <POD> -n <NAMESPACE>
...
Init Containers:
  traceable-javaagent-init:
    Container ID:  docker://a71000bd5bc2eab1f03c76c3156f6c8105c64b5baaa2c3ef1fce9434cd62aed5
    Image:         traceableai/javaagent:1.0.0
...

Was this article helpful?