mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-08 20:07:55 -04: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;
|
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
|
let exporter = create_exporter ~config () in
|
||||||
OTEL.Main_exporter.set exporter;
|
OTEL.Main_exporter.set exporter;
|
||||||
|
|
||||||
|
|
@ -131,12 +131,14 @@ let remove_exporter () : unit =
|
||||||
|
|
||||||
let remove_backend = remove_exporter
|
let remove_backend = remove_exporter
|
||||||
|
|
||||||
let setup ?config ?(enable = true) () =
|
let setup ?(config : Config.t = Config.make ()) ?(enable = true) () =
|
||||||
if enable then ignore (setup_ ?config () : OTEL.Exporter.t)
|
if enable && not config.common.sdk_disabled then
|
||||||
|
ignore (setup_ ~config () : OTEL.Exporter.t)
|
||||||
|
|
||||||
let with_setup ?after_shutdown ?config ?(enable = true) () f =
|
let with_setup ?after_shutdown ?(config : Config.t = Config.make ())
|
||||||
if enable then (
|
?(enable = true) () f =
|
||||||
let exp = setup_ ?config () in
|
if enable && not config.common.sdk_disabled then (
|
||||||
|
let exp = setup_ ~config () in
|
||||||
Fun.protect f ~finally:(fun () -> shutdown_and_wait ?after_shutdown exp)
|
Fun.protect f ~finally:(fun () -> shutdown_and_wait ?after_shutdown exp)
|
||||||
) else
|
) else
|
||||||
f ()
|
f ()
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ type log_level =
|
||||||
type rest = unit
|
type rest = unit
|
||||||
|
|
||||||
type t = {
|
type t = {
|
||||||
debug: bool; [@alert deprecated "Use log_level instead"]
|
debug: bool;
|
||||||
log_level: log_level;
|
log_level: log_level;
|
||||||
sdk_disabled: bool;
|
sdk_disabled: bool;
|
||||||
url_traces: string;
|
url_traces: string;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue