From 916b962c434f7fbc3330555c6fc10fc8d367cceb Mon Sep 17 00:00:00 2001 From: Shon Feder Date: Mon, 23 Jun 2025 17:04:59 -0400 Subject: [PATCH] Expose default_url in config No reason to keep this value hidden, and we want to reuse it for tests. --- src/client/config.ml | 4 ++-- src/client/config.mli | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/client/config.ml b/src/client/config.ml index 2bdb633d..6a832291 100644 --- a/src/client/config.ml +++ b/src/client/config.ml @@ -36,6 +36,8 @@ let pp out (self : t) : unit = debug self_trace url_traces url_metrics url_logs ppheaders headers ppiopt batch_traces ppiopt batch_metrics ppiopt batch_logs batch_timeout_ms +let default_url = "http://localhost:4318" + type 'k make = ?debug:bool -> ?url:string -> @@ -73,8 +75,6 @@ module Env () : ENV = struct let set_debug b = debug_ := b - let default_url = "http://localhost:4318" - let make_get_from_env env_name = let value = ref None in fun () -> diff --git a/src/client/config.mli b/src/client/config.mli index f3a4e6ec..b8d0238f 100644 --- a/src/client/config.mli +++ b/src/client/config.mli @@ -38,6 +38,9 @@ type t = private { To build one, use {!make} below. This might be extended with more fields in the future. *) +val default_url : string +(** The default base URL for the config. *) + val pp : Format.formatter -> t -> unit type 'k make = @@ -59,8 +62,8 @@ type 'k make = @param url base url used to construct per-signal urls. Per-signal url options take - precedence over this base url. Default is "http://localhost:4318", or - "OTEL_EXPORTER_OTLP_ENDPOINT" if set. + precedence over this base url. If not provided, this defaults to + "OTEL_EXPORTER_OTLP_ENDPOINT" if set, or if not {!default_url}. Example of constructed per-signal urls with the base url http://localhost:4318