Documentation forSolarWinds Observability

Add a Java service

The Java Library provides automatic tracing and metrics for JVM-based languages. For new features, fixed issues, and updated components, see the Java Library Release Notes.

The Java Library is a custom distro based on the OpenTelemetry Java agent. In addition to the offering full compatibility with OpenTelemetry, the Java Library adds extra features.

Get started

Ensure that your application components are supported and the platform for your APM library is supported. Also, verify your firewall configuration permits TCP/HTTPS/TLS outbound connections to (where xx-yy is determined by the URL you use to access SolarWinds Observability, see Endpoint URIs) using port 443. See Firewall or access control requirements.

To enable instrumentation for a Java application and send the data to SolarWinds Observability:

  1. In SolarWinds Observability, click Add Data in the upper-right corner.

  2. In the Add Data dialog, click Services.

  3. Type a Name for your service and select the Java language for your operating system. Click Next.

  4. Create or select an API ingestion token to use when sending your collected service data by doing either of the following:

    • Select Generate New Token and enter an Ingestion Token Name, then click Next.
    • Select Use Existing Token and select an ingestion token from the list, then click Next.
  5. Download and install the library JAR on the host system.

  6. Set the service key and endpoint. These properties can be defined in the configuration file, set with environment variables, or defined in the Java system properties when loading the library.

    • See Service key for instructions to set the service key via environment variable or configuration file. The endpoint is (where xx-yy is determined by the URL you use to access SolarWinds Observability, see Endpoint URIs), and the Service key follows the format YourApiToken:YourServiceName. To find your Service key, look for the sw.apm.service.key property value in the code sample provided under Load the library into your application.

    • To define it in the Java system properties, see the next step.
  7. Load the library for monitoring. Use the code sample provided under Load the library into your application, but replace </path/to/solarwinds-apm-agent.jar> with the path to the .jar file downloaded earlier. For instructions for your specific web server, see Load the library.

    Restart the JVM to load the library.

  8. When the Java Library successfully connects to the SolarWinds APM collector, the Waiting for Connection button in SolarWinds Observability changes to OK.

  9. Click OK to finish setting up the service.

To tailor the installed library to your monitoring needs, see Configure the Java Library.

Custom instrumentation

Custom instrumentation can be used to get extra application-specific visibility in SolarWinds Observability, both adding custom spans for distributed tracing and adding custom timers or counters for alerting. See Java Library instrumentation SDK.

Code profiling

Code profiling provides extra insight into code level execution time that is otherwise not captured by auto-instrumentation. See code profiling and the Java-specific details for more on this feature.