Skip to main content

Automatic start (early start)

Since SDK 2.3.0, Kotzilla can boot automatically at process start — before your first line of code runs — so early crashes and startup timing are captured even if they happen before you would have called monitoring(). This is called early start (auto‑boot) and is on by default.

You still keep your monitoring() call

Early start does not replace monitoring() — it complements it. Your generated monitoring() call configures Koin tracking and your app version as before; early start just ensures the SDK is alive from the earliest legal moment on each platform. If early start has already booted the SDK, monitoring() attaches to the running instance.

What boots, and when

PlatformMechanismEarliest capture point
AndroidContentProvider / AndroidX Startup initializerBefore Application.onCreate
iOSObjective‑C pre‑main bootstrap (+load / constructor)Before main()
JVM (plain JVM, Spring Boot, Quarkus, Micronaut, Desktop, GraalVM)ServiceLoader auto‑init on first reference to KotzillaCoreSDKFirst touch of an SDK class
JS / WASMNo pre‑main hookFrom your first KotzillaCoreSDK.setup(...) call

Each platform captures uncaught exceptions from the earliest point it can reach. Errors thrown before that point (for example, on JS/WASM before your setup(...) call, or inside an iOS App Extension) are a documented limitation.

Configuration

All flags live in the kotzilla {} block. earlyStart is the global default; the per‑platform flags inherit from it unless set explicitly.

kotzilla {
earlyStart = true // Global default (default: true)
androidEarlyStart = true // Inherits earlyStart if omitted
iosEarlyStart = true // Inherits earlyStart if omitted
jvmEarlyStart = true // Inherits earlyStart if omitted

// Android only — how the provider is registered:
androidEarlyStartMechanism = io.kotzilla.gradle.ext.EarlyStartMechanism.AUTO // AUTO | OWN_PROVIDER | JETPACK_INITIALIZER
}

To disable auto‑boot everywhere, set earlyStart = false. To disable it on a single platform, set that platform's flag to false (e.g. androidEarlyStart = false).

Runtime overrides without rebuilding (JVM)

On the JVM you can also disable auto‑init at deploy time, which is handy for ops:

-Dio.kotzilla.autoinit=false        # JVM system property (wins over the env var)
KOTZILLA_AUTOINIT=false # environment variable

Only the exact string false (case‑insensitive) disables it — any other value keeps auto‑init on, so a typo can never silently switch monitoring off.

Environment and logging on the early‑start path

The auto‑boot path has no onConfig { } lambda, so two build‑time DSL values are baked into the generated config and applied when it connects:

  • site — an auto‑booted app connects to the self‑hosted gateway you configured instead of the default managed gateway. See Gradle plugin configuration.
  • displayLogs = true — enables runtime SDK debug logs on the auto‑boot path (which otherwise has no way to turn them on). This is a debug switch and the logs include the bearer token — never ship it enabled.

iOS setup

iOS early start ships as a small Objective‑C CocoaPod (kotzilla-sdk-ios-startup) and the Gradle plugin auto‑exports the required framework symbols. No manual wiring is needed when iosEarlyStart is on. App Extensions are excluded automatically — call KotzillaCoreSDK.setupAndConnect() manually from an extension if you monitor one.

If you need to propagate iosEarlyStart = false or consentRequired = true into the pre‑main bootstrap, run:

./gradlew setupKotzillaXcode

This injects an Info.plist build phase that carries those flags to the native bootstrap without touching your source Info.plist.