rename Client_config to Http_config

more accurate, really.
This commit is contained in:
Simon Cruanes 2025-12-15 15:51:48 -05:00
parent dfb0befab0
commit 09e4620603
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
12 changed files with 42 additions and 38 deletions

View file

@ -1,7 +1,7 @@
type t = Opentelemetry_client.Client_config.t type t = Opentelemetry_client.Http_config.t
module Env = Opentelemetry_client.Client_config.Env () module Env = Opentelemetry_client.Http_config.Env ()
let pp = Opentelemetry_client.Client_config.pp let pp = Opentelemetry_client.Http_config.pp
let make = Env.make (fun common () -> common) let make = Env.make (fun common () -> common)

View file

@ -1,4 +1,4 @@
type t = Opentelemetry_client.Client_config.t type t = Opentelemetry_client.Http_config.t
(** Configuration. (** Configuration.
To build one, use {!make} below. This might be extended with more fields in To build one, use {!make} below. This might be extended with more fields in
@ -6,7 +6,7 @@ type t = Opentelemetry_client.Client_config.t
val pp : Format.formatter -> t -> unit val pp : Format.formatter -> t -> unit
val make : (unit -> t) Opentelemetry_client.Client_config.make val make : (unit -> t) Opentelemetry_client.Http_config.make
(** Make a configuration {!t}. *) (** Make a configuration {!t}. *)
module Env : Opentelemetry_client.Client_config.ENV module Env : Opentelemetry_client.Http_config.ENV

View file

@ -1,7 +1,7 @@
type t = Opentelemetry_client.Client_config.t type t = Opentelemetry_client.Http_config.t
module Env = Opentelemetry_client.Client_config.Env () module Env = Opentelemetry_client.Http_config.Env ()
let pp = Opentelemetry_client.Client_config.pp let pp = Opentelemetry_client.Http_config.pp
let make = Env.make (fun common () -> common) let make = Env.make (fun common () -> common)

View file

@ -1,4 +1,4 @@
type t = Opentelemetry_client.Client_config.t type t = Opentelemetry_client.Http_config.t
(** Configuration. (** Configuration.
To build one, use {!make} below. This might be extended with more fields in To build one, use {!make} below. This might be extended with more fields in
@ -6,7 +6,7 @@ type t = Opentelemetry_client.Client_config.t
val pp : Format.formatter -> t -> unit val pp : Format.formatter -> t -> unit
val make : (unit -> t) Opentelemetry_client.Client_config.make val make : (unit -> t) Opentelemetry_client.Http_config.make
(** Make a configuration {!t}. *) (** Make a configuration {!t}. *)
module Env : Opentelemetry_client.Client_config.ENV module Env : Opentelemetry_client.Http_config.ENV

View file

@ -1,7 +1,7 @@
type t = Opentelemetry_client.Client_config.t type t = Opentelemetry_client.Http_config.t
module Env = Opentelemetry_client.Client_config.Env () module Env = Opentelemetry_client.Http_config.Env ()
let pp = Opentelemetry_client.Client_config.pp let pp = Opentelemetry_client.Http_config.pp
let make = Env.make (fun common () -> common) let make = Env.make (fun common () -> common)

View file

@ -1,4 +1,4 @@
type t = Opentelemetry_client.Client_config.t type t = Opentelemetry_client.Http_config.t
(** Configuration. (** Configuration.
To build one, use {!make} below. This might be extended with more fields in To build one, use {!make} below. This might be extended with more fields in
@ -6,7 +6,7 @@ type t = Opentelemetry_client.Client_config.t
val pp : Format.formatter -> t -> unit val pp : Format.formatter -> t -> unit
val make : (unit -> t) Opentelemetry_client.Client_config.make val make : (unit -> t) Opentelemetry_client.Http_config.make
(** Make a configuration {!t}. *) (** Make a configuration {!t}. *)
module Env : Opentelemetry_client.Client_config.ENV module Env : Opentelemetry_client.Http_config.ENV

View file

@ -12,7 +12,7 @@ type t = {
[ticker_thread] is [true]. This will be clamped between [2 ms] and [ticker_thread] is [true]. This will be clamped between [2 ms] and
some longer interval (maximum [60s] currently). Default 500. some longer interval (maximum [60s] currently). Default 500.
@since 0.7 *) @since 0.7 *)
common: Client_config.t; common: Http_config.t;
(** Common configuration options (** Common configuration options
@since 0.12*) @since 0.12*)
} }
@ -22,9 +22,9 @@ let pp out self =
Format.fprintf out Format.fprintf out
"{@[ bg_threads=%d;@ ticker_thread=%B;@ ticker_interval_ms=%d;@ common=%a \ "{@[ bg_threads=%d;@ ticker_thread=%B;@ ticker_interval_ms=%d;@ common=%a \
@]}" @]}"
bg_threads ticker_thread ticker_interval_ms Client_config.pp common bg_threads ticker_thread ticker_interval_ms Http_config.pp common
module Env = Client_config.Env () module Env = Http_config.Env ()
let make = let make =
Env.make Env.make

View file

@ -12,7 +12,7 @@ type t = {
[ticker_thread] is [true]. This will be clamped between [2 ms] and [ticker_thread] is [true]. This will be clamped between [2 ms] and
some longer interval (maximum [60s] currently). Default 500. some longer interval (maximum [60s] currently). Default 500.
@since 0.7 *) @since 0.7 *)
common: Opentelemetry_client.Client_config.t; common: Opentelemetry_client.Http_config.t;
(** Common configuration options (** Common configuration options
@since 0.12*) @since 0.12*)
} }
@ -29,7 +29,7 @@ val make :
?ticker_interval_ms:int -> ?ticker_interval_ms:int ->
unit -> unit ->
t) t)
Opentelemetry_client.Client_config.make Opentelemetry_client.Http_config.make
(** Make a configuration {!t}. *) (** Make a configuration {!t}. *)
module Env : Opentelemetry_client.Client_config.ENV module Env : Opentelemetry_client.Http_config.ENV

View file

@ -10,7 +10,7 @@ open struct
end end
(** Given an exporter, add batches for each emitter according to [config]. *) (** Given an exporter, add batches for each emitter according to [config]. *)
let add_batching ~(config : Client_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 add_batch_opt (b : int option) e = let add_batch_opt (b : int option) e =

View file

@ -31,7 +31,7 @@ module Make
val consumer : val consumer :
?override_n_workers:int -> ?override_n_workers:int ->
ticker_task:float option -> ticker_task:float option ->
config:Client_config.t -> config:Http_config.t ->
unit -> unit ->
Consumer.any_signal_l_builder Consumer.any_signal_l_builder
(** Make a consumer builder, ie. a builder function that will take a bounded (** Make a consumer builder, ie. a builder function that will take a bounded
@ -42,19 +42,18 @@ module Make
seconds, or [None] to not start such a task at all. *) seconds, or [None] to not start such a task at all. *)
end = struct end = struct
module Sender : module Sender :
Generic_consumer.SENDER Generic_consumer.SENDER with module IO = IO and type config = Http_config.t =
with module IO = IO struct
and type config = Client_config.t = struct
module IO = IO module IO = IO
type config = Http_config.t
type t = { type t = {
config: Client_config.t; config: config;
encoder: Pbrt.Encoder.t; encoder: Pbrt.Encoder.t;
http: Httpc.t; http: Httpc.t;
} }
type config = Client_config.t
let create ~config () : t = let create ~config () : t =
{ config; http = Httpc.create (); encoder = Pbrt.Encoder.create () } { config; http = Httpc.create (); encoder = Pbrt.Encoder.create () }
@ -77,7 +76,7 @@ end = struct
let default_n_workers = 50 let default_n_workers = 50
let consumer ?override_n_workers ~ticker_task ~(config : Client_config.t) () : let consumer ?override_n_workers ~ticker_task ~(config : Http_config.t) () :
Consumer.any_signal_l_builder = Consumer.any_signal_l_builder =
let n_workers = let n_workers =
min 2 min 2

View file

@ -1,9 +1,12 @@
(** Constructing and managing the configuration needed in common by all clients (** Constructing and managing the configuration common to many (most?)
*) HTTP-based clients.
This is extended and reused by concrete client implementations that exports
signals over HTTP, depending on their needs. *)
type t = private { type t = private {
debug: bool; debug: bool; (** Debug the client itself? *)
url_traces: string; (** Url to send traces *) url_traces: string; (** Url to send traces/spans *)
url_metrics: string; (** Url to send metrics*) url_metrics: string; (** Url to send metrics*)
url_logs: string; (** Url to send logs *) url_logs: string; (** Url to send logs *)
headers: (string * string) list; headers: (string * string) list;
@ -33,7 +36,9 @@ type t = private {
Default [false]. Default [false].
@since 0.7 *) @since 0.7 *)
http_concurrency_level: int option; http_concurrency_level: int option;
(** How many HTTP requests can be done simultaneously (at most)? (** How many HTTP requests can be done simultaneously (at most)? This can
be used to represent the size of a pool of workers where each worker
gets a batch to send, send it, and repeats.
@since NEXT_RELEASE *) @since NEXT_RELEASE *)
} }
(** Configuration. (** Configuration.