-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Garvit Joshi edited this page Apr 2, 2026
·
5 revisions
tremor-client-java is a lightweight Java 8 client for Tremor ingestion. It keeps the public API small, uses OkHttp for transport, Gson for JSON, and focuses on one job: sending exception events to Tremor cleanly.
TremorClient is thread-safe and can be reused as a singleton in your application.
- Synchronous ingestion to
POST /tremor/api/v1/ingest - Direct
Throwablecapture for the easy path - Explicit event builders when you want full payload control
- Caller-managed or library-managed
OkHttpClient - Local validation before the HTTP request is sent
- Fingerprint return value from Tremor on success
import in.riido.tremor.client.TremorClient;
public final class ErrorReporter {
private final String tremorKey = "...";
private final TremorClient tremorClient =
TremorClient.builder(tremorKey).baseUrl("https://tremor.example.com/tremor").build();
public TremorClient tremor() {
return tremorClient;
}
}Most applications should create one TremorClient and reuse it.
import in.riido.tremor.client.TremorCaptureOptions;
import in.riido.tremor.client.TremorClient;
public final class OrderService {
private final String tremorKey = "...";
private final TremorClient tremorClient =
TremorClient.builder(tremorKey).baseUrl("https://tremor.example.com/tremor").build();
public void processOrder(String orderId) {
try {
chargePayment(orderId);
reserveInventory(orderId);
} catch (Exception exception) {
tremorClient.send(
exception,
TremorCaptureOptions.builder()
.tag("orders")
.tag("payment")
.tag("critical")
.putUserCustomData("orderId", orderId)
.version("1.2.3")
.build());
throw exception;
}
}
}This is the most common pattern: catch, send to Tremor with tags and custom data, then keep your normal exception flow.
import in.riido.tremor.client.TremorCaptureOptions;
import in.riido.tremor.client.TremorClient;
public final class CacheRefreshJob {
private final String tremorKey = "...";
private final TremorClient tremorClient =
TremorClient.builder(tremorKey).baseUrl("https://tremor.example.com/tremor").build();
public void refresh() {
tremorClient.reportAndSuppress(
TremorCaptureOptions.builder().tag("background-job").build(),
() -> {
refreshCacheFromRemote();
});
}
}Use reportAndSuppress(...) only when you intentionally want to report the failure and continue running.
import in.riido.tremor.client.TremorClient;
import in.riido.tremor.client.model.TremorError;
import in.riido.tremor.client.model.TremorEvent;
import in.riido.tremor.client.model.TremorStackFrame;
String tremorKey = "...";
TremorError error = TremorError.builder()
.className("java.lang.IllegalStateException")
.message("checkout failed")
.frame(new TremorStackFrame("CheckoutService", "submit", "CheckoutService.java", 42))
.build();
TremorEvent event = TremorEvent.builder()
.machineName("api-1")
.version("1.2.3")
.tag("payments")
.error(error)
.build();
try (TremorClient client = TremorClient.builder(tremorKey).build()) {
String fingerprint = client.send(event);
}- Java 8 or higher
- A Tremor server exposing
/tremor/api/v1/ingest
Apache License 2.0
Tremor Java Client | Repository | Issues | README