Deploy this integration to enable automatic instrumentation of your Java application using OpenTelemetry.
This integration includes:
- Downloading the OpenTelemetry Java agent to your application host
- Installing the OpenTelemetry collector with Logz.io exporter
- Establishing communication between the agent and collector
On deployment, the Java agent automatically captures spans from your application and forwards them to the collector, which exports the data to your Logz.io account.
Setup auto-instrumentation for your locally hosted Java application and send traces to Logz.io
Before you begin, you’ll need:
- A Java application without instrumentation
- An active account with Logz.io
4317available on your host system
- A name defined for your tracing service
Download Java agent
Download the latest version of the OpenTelemetry Java agent to the host of your Java application.
Download and configure OpenTelemetry collector
Known Issue, June 2021: OpenTelemetry collector version 0.24 and above does not function as expected when deployed with the Logz.io exporter. To remediate this issue, if you’re currently using version 0.24 or above, replace your OpenTelemetry collector with version 0.23 or lower. The resolution for this issue is in development and is expected later this year.
Create a dedicated directory on the host of your Java application and download the OpenTelemetry collector that is relevant to the operating system of your host.
After downloading the collector, create a configuration file
config.yaml with the following parameters:
receivers: otlp: protocols: grpc: http: exporters: logzio: account_token: "<<TRACING-SHIPPING-TOKEN>>" #region: "<<LOGZIO_ACCOUNT_REGION_CODE>>" - (Optional): Your logz.io account region code. Defaults to "us". Required only if your logz.io region is different than US East. https://docs.logz.io/user-guide/accounts/account-region.html#available-regions processors: batch: extensions: pprof: endpoint: :1777 zpages: endpoint: :55679 health_check: service: extensions: [health_check, pprof, zpages] pipelines: traces: receivers: [otlp] processors: [batch] exporters: [logzio]
Start the collector
Run the following command:
<path/to>/otelcontribcol_<VERSION-NAME> --config ./config.yaml
<path/to>with the path to the directory where you downloaded the collector.
<VERSION-NAME>with the version name of the collector applicable to your system, e.g.
Attach the agent to the collector and run it
Run the following command from the directory of your Java application:
java -javaagent:<path/to>/opentelemetry-javaagent-all.jar \ -Dotel.traces.exporter=otlp \ -Dotel.metrics.exporter=none \ -Dotel.resource.attributes=service.name=<YOUR-SERVICE-NAME> \ -Dotel.exporter.otlp.endpoint=http://localhost:4317 \ -jar target/*.jar
<path/to>with the path to the directory where you downloaded the agent.
<YOUR-SERVICE-NAME>with the name of your tracing service defined earlier.
Check Logz.io for your traces
Give your traces some time to get from your system to ours, and then open Tracing.