mirror of
https://github.com/ocaml-tracing/ocaml-trace.git
synced 2026-05-05 08:54:27 -04:00
fix lwt test by providing a local ambient span provider
This commit is contained in:
parent
3a349e1b36
commit
8005926bfc
1 changed files with 12 additions and 1 deletions
|
|
@ -3,10 +3,21 @@
|
|||
open Test_trace_common
|
||||
|
||||
let ( let@ ) = ( @@ )
|
||||
let k_ambient_span : Trace_core.span Lwt.key = Lwt.new_key ()
|
||||
|
||||
let ambient_span_provider : Trace_core.Ambient_span_provider.t =
|
||||
ASP_some
|
||||
( (),
|
||||
{
|
||||
get_current_span = (fun () -> Lwt.get k_ambient_span);
|
||||
with_current_span_set_to =
|
||||
(fun () span f ->
|
||||
Lwt.with_value k_ambient_span (Some span) (fun () -> f span));
|
||||
} )
|
||||
|
||||
let () =
|
||||
print_endline "=== ambient span (Lwt) ===";
|
||||
Trace_core.set_ambient_context_provider Trace_lwt.ambient_span_provider;
|
||||
Trace_core.set_ambient_context_provider ambient_span_provider;
|
||||
let coll = make_recorder () in
|
||||
let@ () = Trace_core.with_setup_collector coll in
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue