client ocurl: handle config.sdk_disabled

This commit is contained in:
Simon Cruanes 2026-02-12 21:27:20 -05:00
parent ccd4c43a93
commit 5114b6a8e7
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
2 changed files with 9 additions and 7 deletions

View file

@ -105,7 +105,7 @@ let shutdown_and_wait ?(after_shutdown = ignore) (self : OTEL.Exporter.t) : unit
after_shutdown self;
()
let setup_ ?(config : Config.t = Config.make ()) () : OTEL.Exporter.t =
let setup_ ~config () : OTEL.Exporter.t =
let exporter = create_exporter ~config () in
OTEL.Main_exporter.set exporter;
@ -131,12 +131,14 @@ let remove_exporter () : unit =
let remove_backend = remove_exporter
let setup ?config ?(enable = true) () =
if enable then ignore (setup_ ?config () : OTEL.Exporter.t)
let setup ?(config : Config.t = Config.make ()) ?(enable = true) () =
if enable && not config.common.sdk_disabled then
ignore (setup_ ~config () : OTEL.Exporter.t)
let with_setup ?after_shutdown ?config ?(enable = true) () f =
if enable then (
let exp = setup_ ?config () in
let with_setup ?after_shutdown ?(config : Config.t = Config.make ())
?(enable = true) () f =
if enable && not config.common.sdk_disabled then (
let exp = setup_ ~config () in
Fun.protect f ~finally:(fun () -> shutdown_and_wait ?after_shutdown exp)
) else
f ()

View file

@ -12,7 +12,7 @@ type log_level =
type rest = unit
type t = {
debug: bool; [@alert deprecated "Use log_level instead"]
debug: bool;
log_level: log_level;
sdk_disabled: bool;
url_traces: string;