← Back to reference

Java Sdk Reference

Install

<dependency>
  <groupId>ai.denpex</groupId>
  <artifactId>denpex-sdk-java</artifactId>
  <version>0.7.0</version>
</dependency>

Modules

  • ai.denpex.client.DenpexClient — REST + OTLP client.
  • ai.denpex.bindings.NvmlBridge — JNI bridge to NVML (opt-in).

Usage

import ai.denpex.client.DenpexClient;
import ai.denpex.client.IncidentQuery;

DenpexClient client = new DenpexClient(
    "https://api.denpex.ai", "<token>", "<tenant>");
IncidentsResponse resp = client
    .incidents()
    .list(new IncidentQuery().state("open").limit(25));
for (Incident inc : resp.getNodes()) {
    System.out.println(inc.getSeverity() + ": " + inc.getHost());
}

NVML JNI Bridge (Opt-in)

import ai.denpex.bindings.NvmlBridge;

NvmlBridge nvml = new NvmlBridge();
nvml.init();
int n = nvml.deviceCount();
for (int i = 0; i < n; i++) {
    String uuid = nvml.uuidByIndex(i);
    double temp = nvml.temperature(i, NVML_TEMPERATURE_GPU);
    System.out.println(uuid + ": " + temp + "C");
}
nvml.shutdown();

Compatibility

  • Java 17+.
  • Maven + Gradle.

Tests

denpex-sdk-java/src/test/:

  • 3 unit tests per module.
  • 1 integration test against a mock server.

Caveats

  • The NVML JNI bridge is opt-in. To enable, add -DenableNvmlBridge=1 to the JVM args and ship the proper .so / .dll on the library path.