OtlpEdge

interface OtlpEdge

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

The contract is intentionally minimal so the bridge stays decoupled from any specific transport: the edge exposes what it already has (digest) and accepts what it is missing (send).

Keep :kuilt-core types off this surface. The bridge consumes Seam and Loom as an implementation detail; neither leaks through here. Consumers depend on :kuilt-otel; they should not need to depend on :kuilt-core just to wire up a backend.

Implementations

  • A Ktor HTTP client that POSTs to POST /v1/traces (OTLP/HTTP protobuf).

  • A test double (us.tractat.kuilt.otel package's RecordingEdge in tests).

Samples

// OtlpEdge is the interface you implement to point the bridge at your backend.
// The bridge calls digest() to learn what the edge already has, then send() for the delta.
//
// Example skeleton — replace with real Ktor HTTP or gRPC:
//
// class KtorOtlpEdge(private val endpoint: String) : OtlpEdge {
//     override suspend fun digest(): SpanDigest {
//         val ids = httpClient.get("$endpoint/v1/traces/digest").body<Set<ByteString>>()
//         return SpanDigest(ids)
//     }
//     override suspend fun send(spans: Set<SpanRecord>, links: List<SpanLink>) {
//         httpClient.post("$endpoint/v1/traces") { setBody(spans.toOtlpJson(links)) }
//     }
// }

Functions

Link copied to clipboard
abstract suspend fun digest(): SpanDigest

Returns a compact summary of which spans this producer has already delivered to the edge (producer-local — see SpanDigest).

Link copied to clipboard
open suspend fun logDigest(): LogDigest

Which log records this producer has already delivered (producer-local; see LogDigest).

Link copied to clipboard
open suspend fun metricDigest(): MetricDigest

The value-version this producer last delivered per series (producer-local; see MetricDigest).

Link copied to clipboard
abstract suspend fun send(spans: Set<SpanRecord>, links: List<SpanLink> = emptyList())

Push a batch of spans to the edge, with their inferred causal links.

Link copied to clipboard
open suspend fun sendLogs(logs: Set<LogRecord>)

Push a batch of log records to the edge. Deduplicated at the collector by record id; WarpOtlpBridge only sends records absent from logDigest.

Link copied to clipboard
open suspend fun sendMetrics(points: Set<MetricPoint>)

Push a batch of metric data points to the edge. WarpOtlpBridge only sends points whose value-hash differs from metricDigest.