Package-level declarations

Types

Link copied to clipboard

Configuration for the Autograph builder.

Link copied to clipboard

Captures the application Context at app startup so the default SeqStore can use it.

Link copied to clipboard
@RequiresOptIn(level = RequiresOptIn.Level.ERROR, message = "This is an Autograph-internal API shared between Autograph's own modules. It is not a supported public API and can change or be removed in any release.")
annotation class AutographInternalApi

Marks a declaration that exists only so Autograph's own modules can share it across a module boundary — not a supported API for library users. It may change or disappear in any release, including a patch.

Link copied to clipboard
fun interface AutographLogger

Sink for the library's own diagnostic messages — a delivery that failed, or an event dropped because it did not validate. Set one on AutographConfig.logger to route these into your app's logging framework (Logcat, os_log, Timber, …) or to silence them; the default prints to the console, matching the library's historical behavior.

Link copied to clipboard

An optional capability of a Tracker: it can shut down and report how the shutdown went. The tracker Autograph returns has it; a view of that tracker that does not own it (such as the one AutographScope hands out) does not.

Link copied to clipboard

What closeAndAwait can tell the caller about a shutdown. A final class the library alone produces (ADR 0001 §2a): properties may be added in a minor version, and the set of outcomes is not an enum that could grow under a caller's when.

Link copied to clipboard
class DebugTransport(delegate: Transport, log: (String) -> Unit = ::println) : Transport, MetadataAwareTransport

Wraps delegate, logging every event before delivering it — for eyeballing outgoing events on a real device/build during manual QA, separate from the app's production transport. Not connected to a warehouse or any assertion tooling (see the planned autograph-test module for unit-test assertions instead).

Link copied to clipboard

Properties the tracker adds to every track and screen event — a tenant, an install id, an experiment assignment: context that belongs to the app rather than to any screen or call site.

Link copied to clipboard
data class Envelope

The instrumentation envelope stamped onto every event.

Link copied to clipboard
interface EnvelopeSource

Provides instrumentation envelopes. Implemented by the library core; transports that run their own event pipeline (e.g. Segment) call stamp from inside that pipeline so that sequence numbers match the actual enqueue order — including events the transport generates itself, such as lifecycle events.

Link copied to clipboard
object EventId

Built-in EventIdGenerator strategies.

Link copied to clipboard
fun interface EventIdGenerator

Generates a unique identifier for each event.

Link copied to clipboard
object EventKinds

The values EventMetadata.kind takes for events the library emits. String constants rather than an enum, so a new kind is an addition rather than a break (ADR 0001 §2e).

Link copied to clipboard
data class EventMetadata

What the library knows about how an event was produced, beyond its name and properties (#287, #243, #242). It is carried in the envelope (Envelope.metadata) and serialized into the same context.instrumentation block, never into properties.

Link copied to clipboard
fun interface EventValidator

Checks a track/screen event against an app-defined tracking-plan contract — a fixed set of event types, required properties, naming conventions — before it reaches the transport.

Link copied to clipboard

A non-persistent SeqStore for tests or ephemeral configurations.

Link copied to clipboard

A Transport that stamps in its own pipeline (Transport.stampsInPipeline) and can add an event's EventMetadata to the envelope it stamps there (ADR 0001 §2c: a capability the core probes with is, because Transport's own member set is frozen).

Link copied to clipboard
sealed interface SeqPersistence

Controls how sequence counters are persisted.

Link copied to clipboard
interface SeqStore

Minimal key-value persistence used for sequence counters and session state.

Link copied to clipboard

Controls which sequence numbers are stamped into the event envelope.

Link copied to clipboard
data class SessionConfig(val backgroundTimeout: Duration = 30.minutes)

Session semantics: a session ends when the app has been inactive for longer than backgroundTimeout. Session state is persisted, so a session survives process restarts as long as activity resumes within the timeout.

Link copied to clipboard
data class SessionInfo

A snapshot of the session an event belongs to.

Link copied to clipboard
interface Tracker

The main entry point for recording analytics events.

Link copied to clipboard
interface Transport

SPI implemented by transport adapters (e.g. autograph-segment).

Link copied to clipboard

One event as intercept's transform sees it. Produced by the library, never constructed by callers (ADR 0001 §2a), so it can gain properties as additions.

Link copied to clipboard

The values TransportEvent.type takes. String constants rather than an enum, so a new type is an addition rather than a break (ADR 0001 §2e).

Properties

Link copied to clipboard
val EmptyJsonObject: JsonObject

An empty JsonObject, useful as a default for event properties.

Link copied to clipboard

The reserved properties key through which the library's own emit sites hand an event's EventMetadata to the tracker (#287).

Functions

Link copied to clipboard
fun Map<String, JsonElement>.asJsonObject(): JsonObject

Narrows a properties map to a JsonObject, wrapping only when it is not already one.

Link copied to clipboard
fun Autograph(configure: AutographConfig.() -> Unit): Tracker

Creates a Tracker.

Link copied to clipboard

This tracker as Kotlin code can safely call: itself when it is written in Kotlin, and otherwise a Kotlin tracker that forwards every call to it with deliverableTo applied.

Link copied to clipboard

Closes this tracker like Tracker.close, but suspends instead of blocking, waits until the shutdown has finished and returns its final result. That is the same exposure as Tracker.close, which also returns only when the shutdown is done: the drain is bounded by AutographConfig.closeDrainTimeoutMillis, but the Transport.flush after it is not, so a transport whose flush blocks holds this call for as long as it blocks (#305). The reason it has no timer of its own is not that the shutdown is bounded: a timer equal to the drain bound would race the shutdown (a drain ending just under the bound, plus a flush, would report a completed shutdown as timed out), and the result would not be deterministic. Use closeAndAwait with a timeout when you need to stop waiting.

suspend fun Tracker.closeAndAwait(timeoutMillis: Long): CloseResult

closeAndAwait with an explicit per-call timeoutMillis for the wait. It bounds this caller's wait only, and a value at or above the drain bound does not guarantee the final result; see AwaitableCloseTracker.closeAndAwait. Long.MAX_VALUE waits for the shutdown to finish, as the no-argument overload does.

Link copied to clipboard
fun createEnvelope(eventId: String, sessionId: String, sessionStartEpochMillis: Long, seq: Long?, globalSeq: Long?, sdk: String, eventTimestamp: String, schemaVersion: String? = null, metadata: EventMetadata? = null): Envelope

Builds an Envelope with caller-chosen field values, bypassing the stamper.

Link copied to clipboard
fun createEventMetadata(kind: String? = null, impressionMinDurationMs: Long? = null, impressionMinFractionVisible: Double? = null, screenViewId: String? = null): EventMetadata

Builds an EventMetadata with caller-chosen field values, for the same reason and with the same lack of guarantees as createEnvelope. Use testEventMetadata(...) from autograph-test instead.

Link copied to clipboard
fun Map<String, JsonElement>.deliverableTo(receiver: Any): Map<String, JsonElement>

These properties as receiver can take them: unchanged for a receiver written in Kotlin, and with every nested object or array value replaced by its JSON text for one written in Swift or Objective-C (#299).

Link copied to clipboard

A transport that runs transform on every event before handing it to this one: to redact a property, add one, or drop the event (return null) for sampling (#302).

Link copied to clipboard

Returns the platform-default SeqStore: a FileSeqStore under the app's private data directory, or an InMemorySeqStore if no writable directory is available (in which case counters do not survive a restart).

Link copied to clipboard
fun Map<String, JsonElement>.withEventMetadata(kind: String?, impressionMinDurationMs: Long? = null, impressionMinFractionVisible: Double? = null, screenViewId: String? = null): JsonObject

These properties with the library's EventMetadata written on top under RESERVED_METADATA_KEY, for Autograph's own emit sites. Apply it last, after any scope merge, so the emit site's value is the one the tracker reads; whatever was under the key before is replaced.