-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration
Garvit Joshi edited this page Apr 2, 2026
·
4 revisions
This page covers the client builder, base URL rules, and OkHttpClient ownership model.
TremorClient is the main public entry point.
| Builder call | Use case |
|---|---|
TremorClient.builder(tremorKey).build() |
Use local Tremor at http://localhost:8080/tremor
|
TremorClient.builder(tremorKey).baseUrl(baseUrl).build() |
Use a specific Tremor server |
TremorClient.builder(tremorKey).httpClient(okHttpClient).build() |
Reuse your own shared OkHttpClient with the default base URL |
TremorClient.builder(tremorKey).baseUrl(baseUrl).httpClient(okHttpClient).build() |
Reuse your own shared OkHttpClient and custom base URL |
- Default base URL:
http://localhost:8080/tremor - Ingest path:
/api/v1/ingest - Resolved request target:
${baseUrl}/api/v1/ingest -
baseUrlmust be an absolute URL - Trailing
/is normalized away - If
baseUrlalready ends with/api/v1/ingest, it is used as-is
Examples:
String tremorKey = "...";
TremorClient.builder(tremorKey).build();
TremorClient.builder(tremorKey).baseUrl("http://localhost:8080/tremor").build();
TremorClient.builder(tremorKey).baseUrl("https://tremor.example.com/tremor").build();
TremorClient.builder(tremorKey).baseUrl("https://tremor.example.com/tremor/api/v1/ingest").build();Each TremorClient resolves exactly one OkHttpClient.
- If you pass an
OkHttpClient, that single client instance is used - If you do not pass one, the library creates one internally
-
close()only shuts down the internally created client - A caller-provided
OkHttpClientis never shut down by the library
This is the correct setup when your application already has a shared OkHttpClient.
import in.riido.tremor.client.TremorClient;
import okhttp3.OkHttpClient;
String tremorKey = "...";
OkHttpClient okHttpClient = new OkHttpClient();
TremorClient client =
TremorClient.builder(tremorKey)
.baseUrl("https://tremor.example.com/tremor")
.httpClient(okHttpClient)
.build();When the library creates its own OkHttpClient, it uses:
- connect timeout: 5 seconds
- read timeout: 10 seconds
- write timeout: 10 seconds
- call timeout: 30 seconds
If you need different transport behavior, provide your own OkHttpClient.
TremorClient is safe to reuse across threads because:
- configuration is immutable after construction
- request-scoped metadata stays in
TremorEventorTremorCaptureOptions - the resolved
OkHttpClientis shared by the client instance
Use try-with-resources when the library owns the transport:
String tremorKey = "...";
try (TremorClient client = TremorClient.builder(tremorKey).build()) {
client.send(new IllegalStateException("boom"));
}If you pass a shared OkHttpClient, closing TremorClient does not shut down that shared transport.
Tremor Java Client | Repository | Issues | README