Set up Java applications
Use the OpenTelemetry Java agent to export application telemetry without adding SDK registration code. See the connection details before starting.
Install the agent
Download opentelemetry-javaagent.jar from the OpenTelemetry Java instrumentation releases (opens in a new tab). Keep its path for the startup command below.
Configure the agent
Save this as otel.properties. Replace the stack ID and service name:
otel.service.name=my-app
otel.exporter.otlp.endpoint=https://{stackId}-otel.logit.io
otel.exporter.otlp.protocol=http/protobuf
otel.traces.exporter=otlp
otel.metrics.exporter=otlp
otel.logs.exporter=otlpBuild authentication and set the standard SDK header in the JVM's process environment. The dashboard also offers otel.exporter.otlp.headers in its properties configuration; keep credentials in the environment for committed configuration files.
The base endpoint has no port or signal path. The agent appends /v1/logs, /v1/traces and /v1/metrics. Use http/protobuf for the Hosted endpoint.
Start the application
java -javaagent:path/to/opentelemetry-javaagent.jar -Dotel.javaagent.configuration-file=otel.properties -jar myapp.jarReplace the agent and application paths. Run from the directory containing otel.properties, or give its full path. Generate application logs and requests, then check the result.