Module Spindle_client.Otlp

OTLP over HTTP, as JSON: what an OpenTelemetry Collector reads at /v1/traces with no protocol buffers.

val run : ?ratio:float -> ?headers:(string * string) list -> clock:_ Eio.Time.clock -> endpoint:string -> service:string -> t -> (Spindle_http.Trace.exporter -> 'a) -> 'a

run ~clock ~endpoint ~service client f: an exporter for as long as f runs, sending through client to endpoint's /v1/traces -- the Collector's base URL, http://collector:4318 -- every five seconds, or as soon as 512 spans wait, and what is left when f returns:

Spindle_client.Otlp.run ~clock:(Eio.Stdenv.clock env)
  ~endpoint:"http://collector:4318" ~service:"app" client
@@ fun trace -> Spindle.serve env ~trace routes

service is the service.name every span is under; headers go with every post, a collector's credential among them; ratio is Spindle_http.Trace.exporter's. Made where the program starts and no request is, since its posts are calls and a call in a trace is a span: from there they are in none, and record nothing.

At most 2048 spans wait. One ending past that is dropped, and so is a batch the collector refused or never answered; each is a warn line saying how many.