Creating Your Hoglin Instance
The Hoglin SDK is designed to be flexible and easy to configure. In this guide, we’ll walk you through basic SDK initialization along with additional configurations to suit your needs. This instance will be your entrypoint for all Hoglin features.
Basic Initialization
Section titled “Basic Initialization”Hoglin analytics = new Hoglin.Builder("api_key") .build();val analytics = Hoglin.Builder("api_key") .build()Builder options
Section titled “Builder options”The Hoglin.Builder class provides several options to configure your Hoglin instance
| Method | Type | Default | Description |
|---|---|---|---|
enableAutoFlush(b) | Boolean | true | Whether to auto-flush events (perioidcally send a batch of queued events) |
enableAutoExperimentFetch(b) | Boolean | true | Whether to automatically fetch and cache experiment data perioidcally |
requeueFailedFlushes(b) | Boolean | true | Whether events that failed to get flushed should be added back to the event queue |
autoFlushInterval(ms) | Long | 15000 | How often (ms) to auto-flush |
autoExperimentFetchInterval(ms) | Long | 60000 | How often (ms) to automatically fetch experiment data |
maxBatchSize(n) | Int | 10000 | Max events sent per auto-flush, extra requests will remain in the queue |
baseUrl(url) | String | https://api.hoglin.gg | API endpoint - should never be changed outside of certain circumstances |
executor(executor) | ScheduledExecutorService | […] | The default executor used for Hoglin - only change this if you know what you’re doing! |
gson(gson) | GSON | […] | The Gson instance used for serialization and deserialization - register custom serializers instead if applicable |
Discarding your instance
Section titled “Discarding your instance” Safely Shutting Down Learn how to safely shut down the SDK when you're done using it or when your application/server is stopping.