mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-08 03:47:59 -04:00
Allow configuring high_watermark
This commit is contained in:
parent
ca31707395
commit
18f58c3ac5
2 changed files with 18 additions and 12 deletions
|
|
@ -7,14 +7,15 @@ type 'a t = {
|
||||||
mutable start: Mtime.t;
|
mutable start: Mtime.t;
|
||||||
}
|
}
|
||||||
|
|
||||||
let make ?(batch = 1) ?timeout () : _ t =
|
let high_watermark batch_size =
|
||||||
|
if batch_size = 1 then
|
||||||
|
100
|
||||||
|
else
|
||||||
|
batch_size * 10
|
||||||
|
|
||||||
|
let make ?(batch = 1) ?(high_watermark = high_watermark batch) ?timeout () : _ t
|
||||||
|
=
|
||||||
assert (batch > 0);
|
assert (batch > 0);
|
||||||
let high_watermark =
|
|
||||||
if batch = 1 then
|
|
||||||
100
|
|
||||||
else
|
|
||||||
batch * 10
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
size = 0;
|
size = 0;
|
||||||
start = Mtime_clock.now ();
|
start = Mtime_clock.now ();
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,20 @@
|
||||||
|
|
||||||
type 'a t
|
type 'a t
|
||||||
|
|
||||||
val make : ?batch:int -> ?timeout:Mtime.span -> unit -> 'a t
|
val make :
|
||||||
|
?batch:int -> ?high_watermark:int -> ?timeout:Mtime.span -> unit -> 'a t
|
||||||
(** [make ()] is a new batch
|
(** [make ()] is a new batch
|
||||||
|
|
||||||
@param batch
|
@param batch
|
||||||
the number of elements after which the batch will be considered {b full},
|
the number of elements after which the batch will be considered {b full},
|
||||||
and ready to pop. A "high water mark" is also derived form the batch as
|
and ready to pop. Set to [0] to disable batching. It is required that
|
||||||
[if batch = 1 then 100 else batch * 10]. This sets a limit after which new
|
[batch >= 0]. Default [1].
|
||||||
elements will be [`Dropped] by {!push}. Set to [0] to disable batching.
|
|
||||||
Default [1].
|
@param high_watermark
|
||||||
|
the batch size limit after which new elements will be [`Dropped] by
|
||||||
|
{!push}. This prevents the queue from growing too fast for effective
|
||||||
|
transmission in case of signal floods. Default
|
||||||
|
[if batch = 1 then 100 else batch * 10].
|
||||||
|
|
||||||
@param timeout
|
@param timeout
|
||||||
the time span after which a batch is ready to pop, whether or not it is
|
the time span after which a batch is ready to pop, whether or not it is
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue