Without being required to modify the source code you can collect telemetry from an application using automatic instrumentation.
Zero-code instrumentation adds the OpenTelemetry API and SDK capabilities to your application typically as an agent or agent-like installation.
opentelemetry-javaagent.jar from Releases of the pentelemetry-java-instrumentation repository and place the JAR in your preferred directory. The JAR file contains the agent and instrumentation libraries.
You can pass configuration properties via the -D flag.
java -javaagent:path/to/opentelemetry-javaagent.jar \
-Dotel.service.name=your-service-name \
-Dotel.traces.exporter=zipkin \
-jar myapp.jar
————————- OR —————————-
You can also environment variables to configure the agent:
export OTEL_LOGS_EXPORTER="none"
export OTEL_METRICS_EXPORTER="none"
export OTEL_TRACES_EXPORTER="otlp"
export OTEL_SERVICE_NAME=your-service-name \
export OTEL_TRACES_EXPORTER=zipkin
java -javaagent:path/to/opentelemetry-javaagent.jar -jar myapp.jar
Next Chapter: Sampling
Main Page: Click Here