OtlpHttpEdge

class OtlpHttpEdge(client: HttpClient, endpoint: String, store: DurableStore, maxSentIds: Int = DEFAULT_MAX_SENT_IDS, wire: OtlpWireFormat = OtlpWireFormat.JSON) : OtlpEdge

A Ktor OTLP/HTTP OtlpEdge. POSTs each signal to /v1/{traces,logs,metrics} and reconciles by a producer-local sent-set persisted in store — because OTLP/HTTP is write-only, there is no collector read-back.

The wire encoding is selectable via wire: OTLP/JSON (application/json, the default) or OTLP/protobuf (application/x-protobuf, the canonical, more compact OTLP wire many collectors default to). The digest/bridge reconciliation is identical for both — only the request body bytes and Content-Type differ.

The digest is what this producer has already successfully delivered to this endpoint: span and log ids in a bounded id-set, metric series as MetricKey → value hash. The set is folded forward only after a 2xx response, so a failed POST leaves the digest untouched and the next drain retries. The collector deduplicates re-sent spans/logs by id, so a lost sent-set costs bandwidth, never correctness.

The id-set is capped at maxSentIds (drop-oldest) so a long-lived producer's sent-set cannot grow without bound; choose a cap that exceeds the device's realistic offline window.

Parameters

client

caller-owned Ktor HttpClient — it owns the engine, timeouts, TLS, and any auth headers. kuilt does not create or close it.

endpoint

collector base URL, e.g. https://collector:4318.

store

durable persistence for the per-endpoint sent-set.

maxSentIds

cap on the span/log sent-set size (drop-oldest). Metrics are naturally bounded by series count.

wire

OTLP wire encoding to emit. Defaults to OtlpWireFormat.JSON.

Constructors

Link copied to clipboard
constructor(client: HttpClient, endpoint: String, store: DurableStore, maxSentIds: Int = DEFAULT_MAX_SENT_IDS, wire: OtlpWireFormat = OtlpWireFormat.JSON)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open suspend override fun digest(): SpanDigest
Link copied to clipboard
open suspend override fun logDigest(): LogDigest
Link copied to clipboard
open suspend override fun metricDigest(): MetricDigest
Link copied to clipboard
open suspend override fun send(spans: Set<SpanRecord>, links: List<SpanLink>)
Link copied to clipboard
open suspend override fun sendLogs(logs: Set<LogRecord>)
Link copied to clipboard
open suspend override fun sendMetrics(points: Set<MetricPoint>)