From 703755e775309fc5600b1bc0fbdd826e5d3d30cf Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Fri, 5 Dec 2025 15:02:49 -0500 Subject: [PATCH] client config: add http_concurrency_level option --- src/client/client_config.ml | 12 +++++++++--- src/client/client_config.mli | 4 ++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/client/client_config.ml b/src/client/client_config.ml index 6a832291..6dedbeeb 100644 --- a/src/client/client_config.ml +++ b/src/client/client_config.ml @@ -9,6 +9,7 @@ type t = { batch_logs: int option; batch_timeout_ms: int; self_trace: bool; + http_concurrency_level: int option; } let pp out (self : t) : unit = @@ -26,15 +27,17 @@ let pp out (self : t) : unit = batch_metrics; batch_logs; batch_timeout_ms; + http_concurrency_level; } = self in Format.fprintf out "{@[ debug=%B;@ self_trace=%B; url_traces=%S;@ url_metrics=%S;@ \ url_logs=%S;@ headers=%a;@ batch_traces=%a;@ batch_metrics=%a;@ \ - batch_logs=%a;@ batch_timeout_ms=%d @]}" + batch_logs=%a;@ batch_timeout_ms=%d;@ http_concurrency_level=%a @]}" debug self_trace url_traces url_metrics url_logs ppheaders headers ppiopt - batch_traces ppiopt batch_metrics ppiopt batch_logs batch_timeout_ms + batch_traces ppiopt batch_metrics ppiopt batch_logs batch_timeout_ms ppiopt + http_concurrency_level let default_url = "http://localhost:4318" @@ -50,6 +53,7 @@ type 'k make = ?headers:(string * string) list -> ?batch_timeout_ms:int -> ?self_trace:bool -> + ?http_concurrency_level:int -> 'k module type ENV = sig @@ -123,7 +127,8 @@ module Env () : ENV = struct let make k ?(debug = get_debug ()) ?url ?url_traces ?url_metrics ?url_logs ?(batch_traces = Some 400) ?(batch_metrics = Some 20) ?(batch_logs = Some 400) ?(headers = get_headers ()) - ?(batch_timeout_ms = 2_000) ?(self_trace = false) = + ?(batch_timeout_ms = 2_000) ?(self_trace = false) ?http_concurrency_level + = (* Ensure the state is synced, in case these values are passed in explicitly *) set_debug debug; set_headers headers; @@ -165,5 +170,6 @@ module Env () : ENV = struct batch_logs; batch_timeout_ms; self_trace; + http_concurrency_level; } end diff --git a/src/client/client_config.mli b/src/client/client_config.mli index 8af6a844..6aedb128 100644 --- a/src/client/client_config.mli +++ b/src/client/client_config.mli @@ -32,6 +32,9 @@ type t = private { (** If true, the OTEL library will also emit its own spans. Default [false]. @since 0.7 *) + http_concurrency_level: int option; + (** How many HTTP requests can be done simultaneously (at most)? + @since NEXT_RELEASE *) } (** Configuration. @@ -55,6 +58,7 @@ type 'k make = ?headers:(string * string) list -> ?batch_timeout_ms:int -> ?self_trace:bool -> + ?http_concurrency_level:int -> 'k (** A function that gathers all the values needed to construct a {!t}, and produces a ['k]. ['k] is typically a continuation used to construct a