Non-Intrusive Integration of Tracing in Java Applications
INFO
The automatically injected OpenTelemetry Java Agent supports Java 8+ versions.
TOC
Feature Overview
Tracing is a core capability of observability in distributed systems, which can fully record the call paths and performance data of requests within the system. This article describes how to achieve non-intrusive integration of tracing in Java applications using the automatic injection of the OpenTelemetry Java Agent.
Use Cases
Java applications can be integrated for the following scenarios:
- Quickly adding tracing capabilities to Java applications
- Avoiding modifications to the application source code
- Deploying services with Kubernetes
- Visualizing service inter-call relationships and analyzing performance bottlenecks
Prerequisites
Before using this feature, ensure that:
- The target service is deployed on the Alauda Container Platform
- The service is using JDK version Java 8 or higher
- You have editing permissions for the Deployment in the target namespace
- The platform has completed tracing deployment
Steps to Operate
For a Java application that needs to be integrated into the Alauda Container Platform tracing, the following adaptations are required:
- Configure automatic injection annotations for the Java Deployment.
- Set the
SERVICE_NAMEenvironment variable. - Set the
SERVICE_NAMESPACEenvironment variable.
Example of Deployment adaptation:
- Choose
cpaas-system/acp-common-javaInstrumentation as the configuration for injecting the Java Agent. - Configure the
SERVICE_NAMEenvironment variable, which can be associated through labels or fixed values. - Configure the
SERVICE_NAMESPACEenvironment variable, with its value asmetadata.namespace.
Operation Results
After adapting the Java application:
- If the newly started Java application pod contains the
opentelemetry-auto-instrumentation-javainit container, it indicates that the injection was successful. - Send test requests to the Java application.
- In the Container Platform view, select the project, cluster, and namespace where the Java application resides.
- Navigate to the Observability -> Tracing page to view the tracing data and timeline waterfall diagram of the Java application.