fix: perfetto does not render Sync spans as children of Async spans

This commit is contained in:
Matt Bray 2023-09-19 14:24:28 +01:00
parent 75fc4968fc
commit f5c263e23f
2 changed files with 5 additions and 4 deletions

View file

@ -45,10 +45,10 @@ let[@inline never] with_span_real_ ?parent ?(force_toplevel = false)
let espan =
match parent, force_toplevel with
| _, true | None, _ ->
enter_manual_toplevel_span ~flavor:`Sync ?__FUNCTION__ ~__FILE__ ~__LINE__
?data name
enter_manual_toplevel_span ~flavor:`Async ?__FUNCTION__ ~__FILE__
~__LINE__ ?data name
| Some parent, _ ->
enter_manual_sub_span ~parent ~flavor:`Sync ?__FUNCTION__ ~__FILE__
enter_manual_sub_span ~parent ~flavor:`Async ?__FUNCTION__ ~__FILE__
~__LINE__ ?data name
in

View file

@ -38,7 +38,8 @@ val with_span :
'a
(** [with_span ~__FILE__ ~__LINE__ name f] calls [f span]
where [span] is a new span named with [name]. The span is
traced as being synchronous.
traced as being asynchronous, so each collector might represent
it differently.
If [f] returns an ['a Lwt.t] future, use [with_span_lwt] instead.