add Scope.to_span_ctx

This commit is contained in:
Simon Cruanes 2024-02-12 14:00:51 -05:00
parent 1b9ba95faf
commit e001d62fd5
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -672,6 +672,10 @@ module Scope = struct
mutable attrs: key_value list; mutable attrs: key_value list;
} }
(** Turn the scope into a span context *)
let[@inline] to_span_ctx (self : t) : Span_ctx.t =
Span_ctx.make ~trace_id:self.trace_id ~parent_id:self.span_id ()
(** Add an event to the scope. It will be aggregated into the span. (** Add an event to the scope. It will be aggregated into the span.
Note that this takes a function that produces an event, and will only Note that this takes a function that produces an event, and will only