From 8ce4f332c6959cc7b25b1cd439262193f130a074 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Mon, 9 Sep 2024 15:33:09 -0400 Subject: [PATCH] fix: smll change for manual spans --- src/subscriber/callbacks.ml | 2 +- src/subscriber/trace_subscriber.ml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/subscriber/callbacks.ml b/src/subscriber/callbacks.ml index db7df94..fa134b4 100644 --- a/src/subscriber/callbacks.ml +++ b/src/subscriber/callbacks.ml @@ -61,7 +61,7 @@ module type S = sig __LINE__:int -> time_ns:float -> tid:int -> - parent:explicit_span option -> + parent:span option -> data:(string * user_data) list -> name:string -> flavor:[ `Sync | `Async ] option -> diff --git a/src/subscriber/trace_subscriber.ml b/src/subscriber/trace_subscriber.ml index 203ab8c..8a52b9a 100644 --- a/src/subscriber/trace_subscriber.ml +++ b/src/subscriber/trace_subscriber.ml @@ -84,10 +84,10 @@ let collector (Sub { st; callbacks = (module CB) } : Subscriber.t) : collector = let time_ns = now_ns () in (* get the common trace id, or make a new one *) - let trace_id = + let trace_id, parent = match parent with - | Some m -> Meta_map.find_exn key_async_trace_id m.meta - | None -> A.fetch_and_add trace_id_gen_ 1 + | Some m -> Meta_map.find_exn key_async_trace_id m.meta, Some m.span + | None -> A.fetch_and_add trace_id_gen_ 1, None in CB.on_enter_manual_span st ~__FUNCTION__ ~__FILE__ ~__LINE__ ~parent ~data