mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-07 18:37:56 -05:00
client ocurl: handle config.sdk_disabled
This commit is contained in:
parent
ccd4c43a93
commit
5114b6a8e7
2 changed files with 9 additions and 7 deletions
|
|
@ -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 ()
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue