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.
Additionally, zero-code instrumentation lets you configure the Instrumentation Libraries and exporters loaded.
You can configure zero-code instrumentation through environment variables and other language-specific mechanisms, such as system properties or arguments passed to initialization methods. To get started, you only need a service name configured so that you can identify the service in the observability backend of your choice.
⚠️ Note: Some language do not support auto instrumentation.
Other configuration options are available, including:
opentelemetry-javaagent.jar from Releases of the Opentelemetry-java-instrumentation repository and place the JAR in your preferred directory. The JAR file contains the agent and instrumentation libraries.
Java Agent Location: OpenTelemetry Java Agent
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
pip install opentelemetry-distro opentelemetry-exporter-otlp
opentelemetry-bootstrap --action=install
opentelemetry-instrument \
--traces_exporter console,otlp \
--metrics_exporter console \
--service_name your-service-name \
--exporter_otlp_endpoint 0.0.0.0:4317 \
python myapp.py
————————- OR —————————-
export OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.<your-realm>.signalfx.com/v2/trace
export OTEL_EXPORTER_OTLP_HEADERS="X-SF-TOKEN=<your-access-token>"
export OTEL_TRACES_EXPORTER=otlp
export OTEL_METRICS_EXPORTER=none
opentelemetry-instrument python myapp.py
npm install --save @opentelemetry/api
npm install --save @opentelemetry/auto-instrumentations-node
env OTEL_TRACES_EXPORTER=otlp OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=your-endpoint node --require @opentelemetry/auto-instrumentations-node/register app.js
————————- OR —————————-
export OTEL_TRACES_EXPORTER="otlp"
export OTEL_EXPORTER_OTLP_ENDPOINT="your-endpoint"
export OTEL_NODE_RESOURCE_DETECTORS="env,host,os"
export OTEL_SERVICE_NAME="your-service-name"
export NODE_OPTIONS="--require @opentelemetry/auto-instrumentations-node/register"
node app.js
✅ Next Chapter: Sampling
✅ Main Page: Click Here