Package-level declarations

Types

Link copied to clipboard
fun interface AppliedOpSink

Where WarpLogRecordExporter publishes the operations it applied.

Link copied to clipboard

Controls what happens when the in-memory CRDT buffer reaches maxSpans.

Link copied to clipboard
@Serializable
data class CausalStamp(val dot: Dot, val predecessors: Set<Dot>)

A span's position in kuilt's happens-before relation.

Link copied to clipboard
sealed interface DrainResult

The result of a WarpOtlpBridge.drain call.

Link copied to clipboard
interface DurableStore

A durable, typed-key store that persists serialized CRDT state across process restarts.

Link copied to clipboard
data class ExporterHealth(val accepted: Long = 0, val failed: Long = 0, val consecutiveFailures: Int = 0, val lastFailure: Throwable? = null, val recoveryFailed: Boolean = false, val dropped: Long = 0, val refused: Long = 0)

An out-of-band health signal for a durable exporter.

Link copied to clipboard
sealed interface ExportResult
Link copied to clipboard

An in-process, non-durable DurableStore for tests and ephemeral scenarios.

Link copied to clipboard
class LogDigest(val recordIds: Set<ByteString>)

Which log records the producer has already delivered to an OtlpEdge, keyed by LogRecord.recordId.

Link copied to clipboard
@Serializable
data class LogRecord(val recordId: ByteString, val severityNumber: Int? = null, val severityText: String? = null, val body: String? = null, val attributes: Map<String, String> = emptyMap(), val timestampEpochNanos: Long? = null, val observedEpochNanos: Long? = null, val traceId: ByteString? = null, val spanId: ByteString? = null)

A single log-record shaped to round-trip through OTLP.

Link copied to clipboard

Controls what happens when the number of distinct metric series in WarpMetricExporter reaches maxMetrics.

Link copied to clipboard
@Serializable
class MetricCatalog(val sums: Map<MetricKey, GCounter> = emptyMap(), val doubleSums: Map<MetricKey, GCounterDouble> = emptyMap(), val gauges: Map<MetricKey, LWWRegister<Double>> = emptyMap(), val cardinalities: Map<MetricKey, HyperLogLog> = emptyMap(), val histograms: Map<MetricKey, DDSketch> = emptyMap()) : Quilted<MetricCatalog>

A converged snapshot of every metric series a device holds — counters, gauges, distinct-count estimates, and quantile sketches — bundled into one value that replicates as a whole.

Link copied to clipboard
class MetricDigest(val versions: Map<MetricKey, Long>)

The value-version this producer last delivered for each metric series.

Link copied to clipboard
sealed interface MetricExportResult

The result of a WarpMetricExporter mutating call.

Link copied to clipboard
@Serializable
data class MetricKey(val name: String, val kind: MetricKind, val attributes: Map<String, String> = emptyMap())

The identity of a single metric time series.

Link copied to clipboard
@Serializable
enum MetricKind : Enum<MetricKind>

The kind of measurement a metric tracks.

Link copied to clipboard
sealed interface MetricPoint

A single metric data point, rendered from a WarpMetricExporter CRDT (via MetricCatalog) into the shape OTLP puts on the wire. The bridge produces these; an OtlpEdge serializes them — the edge never reaches into the CRDTs directly.

Link copied to clipboard
interface OtlpEdge

An OTLP-capable edge that WarpOtlpBridge drains converged CRDTs into.

Link copied to clipboard
class SpanDigest(val spanIds: Set<ByteString>)

A compact summary of which spans this producer has already delivered to an OtlpEdge, keyed by span id.

Link copied to clipboard
@Serializable
enum SpanKind : Enum<SpanKind>

OTLP span kind values.

Link copied to clipboard
data class SpanLink(val fromSpanId: ByteString, val linkedTraceId: ByteString, val linkedSpanId: ByteString, val attributes: Map<String, String> = mapOf("kuilt.causality" to "potential"))

A derived causal edge: span fromSpanId could have been caused by the predecessor span identified by linkedTraceId / linkedSpanId.

Link copied to clipboard
@Serializable
data class SpanRecord(val traceId: ByteString, val spanId: ByteString, val parentSpanId: ByteString?, val name: String, val kind: SpanKind, val startEpochNanos: Long, val endEpochNanos: Long, val attributes: Map<String, String> = emptyMap(), val status: SpanStatus = SpanStatus.Unset, val causalStamp: CausalStamp? = null)

A completed span record, shaped to round-trip through OTLP.

Link copied to clipboard
@Serializable
sealed interface SpanStatus

OTLP span status.

Link copied to clipboard
value class StoreKey(val name: String)

A typed key for DurableStore entries.

Link copied to clipboard
class WarpCausalClock(replica: ReplicaId)

Mints causal Dots for spans and tracks the current happens-before frontier.

Link copied to clipboard
class WarpLogRecordExporter(replica: ReplicaId, store: DurableStore, maxRecords: Int = DEFAULT_MAX_LOG_RECORDS, bufferPolicy: BufferPolicy = BufferPolicy.DROP_OLDEST, segmentOps: Int = DEFAULT_LOG_SEGMENT_OPS, appliedOps: AppliedOpSink = AppliedOpSink.Discarding)

A CRDT-backed log-record exporter.

Link copied to clipboard
class WarpMetricExporter(replica: ReplicaId, store: DurableStore, maxMetrics: Int = DEFAULT_MAX_METRICS, bufferPolicy: MetricBufferPolicy = MetricBufferPolicy.DROP_OLDEST, histogramPrototype: DDSketch = DDSketch.empty(relativeAccuracy = alphaForOtlpScale(DEFAULT_OTLP_HISTOGRAM_SCALE)))

A CRDT-backed metric exporter for cumulative sums, gauges, and cardinality estimates.

Link copied to clipboard
class WarpOtlpBridge(telemetry: WarpTelemetry, clock: Clock)

Drains converged CRDTs — spans, logs, and metrics — to an OTLP-capable OtlpEdge, reconciling each signal by its own producer-local digest so a re-drain sends only what the endpoint lacks.

Link copied to clipboard
class WarpSpanExporter(replica: ReplicaId, store: DurableStore, maxSpans: Int = DEFAULT_MAX_SPANS, bufferPolicy: BufferPolicy = BufferPolicy.DROP_OLDEST, causalClock: WarpCausalClock? = null)

A CRDT-backed span exporter.

Link copied to clipboard
class WarpTelemetry(replica: ReplicaId, store: DurableStore, maxSpans: Int = DEFAULT_MAX_SPANS, maxLogRecords: Int = DEFAULT_MAX_LOG_RECORDS, bufferPolicy: BufferPolicy = BufferPolicy.DROP_OLDEST, maxMetrics: Int = DEFAULT_MAX_METRICS, metricBufferPolicy: MetricBufferPolicy = MetricBufferPolicy.DROP_OLDEST)

A CRDT-backed, offline-first telemetry surface for Kotlin Multiplatform.

Properties

Link copied to clipboard
const val DEFAULT_LOG_SEGMENT_OPS: Int = 256

Default operations per persisted log segment — the ceiling on how many bytes one WarpLogRecordExporter.export rewrites.

Link copied to clipboard

Maximum number of LogRecords buffered in memory before eviction.

Link copied to clipboard

Default maximum number of distinct metric series buffered in memory.

Link copied to clipboard

Maximum number of SpanRecords buffered in memory before eviction.

Link copied to clipboard

The default OTLP scale for WarpMetricExporter histograms. Scale 5 gives α ≈ 1.083% — the closest OTLP-aligned accuracy to DDSketch.DEFAULT_RELATIVE_ACCURACY (1%), at ≈32 buckets per power of two.

Link copied to clipboard

Largest OTLP exponential-histogram scale (base 2^(2^−20) — ~0.000033% relative accuracy).

Link copied to clipboard

Smallest supported OTLP exponential-histogram scale (base 2^32, α ≈ 1 − 4.7·10⁻¹⁰). OTLP itself permits scales down to −10, but below −5 the equivalent DDSketch α rounds to 1.0 in a Double (and at −10 the base 2^1024 overflows entirely), so no valid sketch exists for those scales.

Functions

Link copied to clipboard

The DDSketch relative accuracy α that aligns exactly with the OTLP exponential-histogram scale: α = (γ−1)/(γ+1) where γ = 2^(2^−scale).

Link copied to clipboard

Derive SpanLinks from the happens-before relation recorded in each span's SpanRecord.causalStamp.

Link copied to clipboard
fun otlpScaleFor(relativeAccuracy: Double): Int

The integer OTLP scale whose base equals a DDSketch's bucket growth factor γ = (1+relativeAccuracy)/(1−relativeAccuracy) — the inverse of alphaForOtlpScale.