mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-07 18:37:56 -05:00
fix batch: make sure high_watermark>=batch, also put a max on batch size
This commit is contained in:
parent
6c832df3a6
commit
2d8939ab0a
1 changed files with 8 additions and 2 deletions
|
|
@ -13,18 +13,24 @@ type 'a t = {
|
|||
timeout: Mtime.span option;
|
||||
}
|
||||
|
||||
let default_high_watermark batch_size = max 10 (min (batch_size * 10) 1_000_000)
|
||||
let max_batch_size = 100_000
|
||||
|
||||
let default_high_watermark batch_size =
|
||||
max 10 (min (batch_size * 10) max_batch_size)
|
||||
|
||||
let _dummy_start = Mtime.min_stamp
|
||||
|
||||
let _empty_state : _ state = { q = []; size = 0; start = _dummy_start }
|
||||
|
||||
let make ?(batch = 100) ?high_watermark ?now ?timeout () : _ t =
|
||||
let batch = min batch max_batch_size in
|
||||
let high_watermark =
|
||||
match high_watermark with
|
||||
| Some x -> x
|
||||
| Some x -> max x batch (* high watermark must be >= batch *)
|
||||
| None -> default_high_watermark batch
|
||||
in
|
||||
assert (high_watermark >= batch);
|
||||
|
||||
let start =
|
||||
match now with
|
||||
| Some x -> x
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue