Support Center Home


Java Instrumentation

There are two ways to approach OpenTelemetry-facilitated instrumentation for a Java application:

  1. Automated instrumentation (recommended)
  2. Manual instrumentation

With auto-instrumentation, you’ll attach a JAR to your application that injects code to capture trace data from supported libraries and frameworks. This is by far the easiest and fastest way to get started, but gives you less control over how trace data is emitted (for example, the operation names are automatically set). For applications that use libraries and frameworks outside of what is supported by the auto-instrumentation, you will need to manually instrument. With manual instrumentation, you’ll write code in your application that uses the OpenTelemetry SDK to capture and emit the trace data. In the end, you may need a combination of both manual and auto-instrumentation.

Prerequisites

Automated Instrumentation

Coming soon!

Manual instrumentation

You may need to manually instrument some or all of your Java applications if (1) you are using libraries that are not supported for the OpenTelemetry auto-instrumentation; or (2) you want to customize how operations are generated by auto-instrumentation (such as how operations are named). 

The best source of instruction for manually instrumenting your Java application is the official OpenTelemetry documentation. This documentation will guide you through instantiating the OpenTelemetry SDK and a tracer, creating traces, and enriching them.

In This Article