Instrument applications with OpenTelemetry SDK and validate telemetry using Kopai. Use when setting up observability, adding tracing/logging/metrics, testing instrumentation, debugging missing telemetry data, or when traces/logs/metrics aren't appearing after setup. Also use when users say things like "my traces aren't showing up", "I don't see any data", or "how do I add observability to my app".
100
100%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Passed
No known issues
| title | impact | tags |
|---|---|---|
| Java Instrumentation | HIGH | lang, java, jvm, traces, logs, metrics |
Impact: HIGH
Set up OpenTelemetry for Java applications using the Java agent for automatic instrumentation.
# Download the latest OpenTelemetry Java agent
curl -L -O https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jarexport OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318"
export OTEL_SERVICE_NAME="my-java-service"
export OTEL_LOGS_EXPORTER="otlp"Environment Variables:
| Variable | Description |
|---|---|
OTEL_EXPORTER_OTLP_ENDPOINT | OTLP endpoint (e.g., http://localhost:4318) |
OTEL_SERVICE_NAME | Service name shown in observability backend |
OTEL_LOGS_EXPORTER | Set to otlp to export logs via OTLP |
# Compile your application
javac MyApp.java
# Run with the agent attached
java -javaagent:opentelemetry-javaagent.jar MyAppOr with a JAR file:
java -javaagent:opentelemetry-javaagent.jar -jar myapp.jarThe Java agent automatically instruments:
java.util.logging, Log4j, SLF4J to OTLPNo code changes required - the agent intercepts calls at runtime.
See the complete working example: kopai-integration-examples/java
rules