rename batching modules

This commit is contained in:
Simon Cruanes 2026-01-12 20:50:53 -05:00
parent 31aadebfd6
commit f31062a602
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
8 changed files with 19 additions and 16 deletions

View file

@ -175,7 +175,7 @@ let create_exporter ?(config = Config.make ()) ~sw ~env () =
~high_watermark:Bounded_queue.Defaults.high_watermark () ~high_watermark:Bounded_queue.Defaults.high_watermark ()
in in
Exporter_queued.create ~clock:Clock.ptime_clock ~q:bq ~consumer () Exporter_queued.create ~clock:Clock.ptime_clock ~q:bq ~consumer ()
|> Exporter_add_batching.add_batching ~config |> Exporter_batch.add_batching ~config
let create_backend = create_exporter let create_backend = create_exporter

View file

@ -115,7 +115,7 @@ let create_exporter ?(config = Config.make ()) () =
~high_watermark:Bounded_queue.Defaults.high_watermark () ~high_watermark:Bounded_queue.Defaults.high_watermark ()
in in
Exporter_queued.create ~clock:Clock.ptime_clock ~q:bq ~consumer () Exporter_queued.create ~clock:Clock.ptime_clock ~q:bq ~consumer ()
|> Exporter_add_batching.add_batching ~config |> Exporter_batch.add_batching ~config
let create_backend = create_exporter let create_backend = create_exporter

View file

@ -86,7 +86,7 @@ let create_exporter ?(config = Config.make ()) () =
~high_watermark:Bounded_queue.Defaults.high_watermark () ~high_watermark:Bounded_queue.Defaults.high_watermark ()
in in
Exporter_queued.create ~clock:Clock.ptime_clock ~q:bq ~consumer () Exporter_queued.create ~clock:Clock.ptime_clock ~q:bq ~consumer ()
|> Exporter_add_batching.add_batching ~config |> Exporter_batch.add_batching ~config
let create_backend = create_exporter let create_backend = create_exporter

View file

@ -93,7 +93,7 @@ let create_exporter ?(config = Config.make ()) () : OTEL.Exporter.t =
in in
OTELC.Exporter_queued.create ~clock:OTEL.Clock.ptime_clock ~q:bq ~consumer () OTELC.Exporter_queued.create ~clock:OTEL.Clock.ptime_clock ~q:bq ~consumer ()
|> OTELC.Exporter_add_batching.add_batching ~config:config.common |> OTELC.Exporter_batch.add_batching ~config:config.common
let create_backend = create_exporter let create_backend = create_exporter

View file

@ -1,26 +1,19 @@
(** Add batching to the emitters of an exporter.
The exporter has multiple emitters (one per signal type), this can add
batching on top of each of them (so that they emit less frequent, larger
batches of signals, amortizing the per-signal cost). *)
open Common_ open Common_
(** Given an exporter, add batches for each emitter according to [config]. *)
let add_batching ~(config : Http_config.t) (exp : OTEL.Exporter.t) : let add_batching ~(config : Http_config.t) (exp : OTEL.Exporter.t) :
OTEL.Exporter.t = OTEL.Exporter.t =
let timeout = Mtime.Span.(config.batch_timeout_ms * ms) in let timeout = Mtime.Span.(config.batch_timeout_ms * ms) in
let emit_spans = let emit_spans =
Emitter_add_batching.add_batching_opt ~timeout Emitter_batch.add_batching_opt ~timeout ~batch_size:config.batch_traces
~batch_size:config.batch_traces exp.emit_spans exp.emit_spans
in in
let emit_metrics = let emit_metrics =
Emitter_add_batching.add_batching_opt ~timeout Emitter_batch.add_batching_opt ~timeout ~batch_size:config.batch_metrics
~batch_size:config.batch_metrics exp.emit_metrics exp.emit_metrics
in in
let emit_logs = let emit_logs =
Emitter_add_batching.add_batching_opt ~timeout ~batch_size:config.batch_logs Emitter_batch.add_batching_opt ~timeout ~batch_size:config.batch_logs
exp.emit_logs exp.emit_logs
in in

View file

@ -0,0 +1,10 @@
(** Add batching to the emitters of an exporter.
The exporter has multiple emitters (one per signal type), this can add
batching on top of each of them (so that they emit less frequent, larger
batches of signals, amortizing the per-signal cost). *)
open Common_
val add_batching : config:Http_config.t -> OTEL.Exporter.t -> OTEL.Exporter.t
(** Given an exporter, add batches for each emitter according to [config]. *)