mirror of
https://github.com/ocaml-tracing/ocaml-trace.git
synced 2026-03-07 18:37:56 -05:00
make tests compile
This commit is contained in:
parent
2a866e60f8
commit
4aee136827
2 changed files with 11 additions and 12 deletions
|
|
@ -7,7 +7,7 @@ let run () =
|
|||
for _i = 1 to 50 do
|
||||
Trace.with_span ~__FILE__ ~__LINE__ "outer.loop" @@ fun _sp ->
|
||||
let pseudo_async_sp =
|
||||
Trace.enter_manual_span ~parent:None ~__FILE__ ~__LINE__ "fake_sleep"
|
||||
Trace.enter_span ~parent:None ~__FILE__ ~__LINE__ "fake_sleep"
|
||||
in
|
||||
|
||||
for _j = 2 to 5 do
|
||||
|
|
@ -22,8 +22,7 @@ let run () =
|
|||
if _j = 2 then (
|
||||
Trace.add_data_to_span _sp [ "j", `Int _j ];
|
||||
let _sp =
|
||||
Trace.enter_manual_span
|
||||
~parent:(Some (Trace.ctx_of_span pseudo_async_sp))
|
||||
Trace.enter_span ~parent:(Some pseudo_async_sp)
|
||||
~flavor:
|
||||
(if _i mod 3 = 0 then
|
||||
`Sync
|
||||
|
|
@ -34,11 +33,11 @@ let run () =
|
|||
|
||||
(* fake micro sleep *)
|
||||
Thread.delay 0.005;
|
||||
Trace.exit_manual_span _sp
|
||||
Trace.exit_span _sp
|
||||
) else if _j = 3 then (
|
||||
(* pretend some task finished. Note that this is not well scoped wrt other spans. *)
|
||||
Trace.add_data_to_manual_span pseudo_async_sp [ "slept", `Bool true ];
|
||||
Trace.exit_manual_span pseudo_async_sp
|
||||
Trace.add_data_to_span pseudo_async_sp [ "slept", `Bool true ];
|
||||
Trace.exit_span pseudo_async_sp
|
||||
)
|
||||
done
|
||||
done
|
||||
|
|
|
|||
12
test/t1.ml
12
test/t1.ml
|
|
@ -7,7 +7,8 @@ let run () =
|
|||
for _i = 1 to 50 do
|
||||
Trace.with_span ~__FILE__ ~__LINE__ "outer.loop" @@ fun _sp ->
|
||||
let pseudo_async_sp =
|
||||
Trace.enter_manual_span ~parent:None ~__FILE__ ~__LINE__ "fake_sleep"
|
||||
Trace.enter_span ~parent:None ~flavor:`Async ~__FILE__ ~__LINE__
|
||||
"fake_sleep"
|
||||
in
|
||||
|
||||
for _j = 2 to 5 do
|
||||
|
|
@ -22,8 +23,7 @@ let run () =
|
|||
if _j = 2 then (
|
||||
Trace.add_data_to_span _sp [ "j", `Int _j ];
|
||||
let _sp =
|
||||
Trace.enter_manual_span
|
||||
~parent:(Some (Trace.ctx_of_span pseudo_async_sp))
|
||||
Trace.enter_span ~parent:(Some pseudo_async_sp)
|
||||
~flavor:
|
||||
(if _i mod 3 = 0 then
|
||||
`Sync
|
||||
|
|
@ -34,11 +34,11 @@ let run () =
|
|||
|
||||
(* fake micro sleep *)
|
||||
Thread.delay 0.005;
|
||||
Trace.exit_manual_span _sp
|
||||
Trace.exit_span _sp
|
||||
) else if _j = 3 then (
|
||||
(* pretend some task finished. Note that this is not well scoped wrt other spans. *)
|
||||
Trace.add_data_to_manual_span pseudo_async_sp [ "slept", `Bool true ];
|
||||
Trace.exit_manual_span pseudo_async_sp
|
||||
Trace.add_data_to_span pseudo_async_sp [ "slept", `Bool true ];
|
||||
Trace.exit_span pseudo_async_sp
|
||||
)
|
||||
done
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue