CtrlK
BlogDocsLog inGet started
Tessl Logo

kopai/otel-instrumentation

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

Quality

100%

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

lang-java.mdrules/

titleimpacttags
Java InstrumentationHIGHlang, java, jvm, traces, logs, metrics

Java Instrumentation

Impact: HIGH

Set up OpenTelemetry for Java applications using the Java agent for automatic instrumentation.

Install

# Download the latest OpenTelemetry Java agent
curl -L -O https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar

Configuration

export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318"
export OTEL_SERVICE_NAME="my-java-service"
export OTEL_LOGS_EXPORTER="otlp"

Environment Variables:

VariableDescription
OTEL_EXPORTER_OTLP_ENDPOINTOTLP endpoint (e.g., http://localhost:4318)
OTEL_SERVICE_NAMEService name shown in observability backend
OTEL_LOGS_EXPORTERSet to otlp to export logs via OTLP

Run with Agent

# Compile your application
javac MyApp.java

# Run with the agent attached
java -javaagent:opentelemetry-javaagent.jar MyApp

Or with a JAR file:

java -javaagent:opentelemetry-javaagent.jar -jar myapp.jar

What Gets Instrumented

The Java agent automatically instruments:

  • Traces: HTTP requests, database calls, messaging systems
  • Logs: Bridges java.util.logging, Log4j, SLF4J to OTLP
  • Metrics: JVM metrics, HTTP request metrics

No code changes required - the agent intercepts calls at runtime.

Example

See the complete working example: kopai-integration-examples/java

Reference

OpenTelemetry Java

SKILL.md

tile.json