feat: add trace.stdext, with standard extensions

This commit is contained in:
Simon Cruanes 2025-04-12 21:10:03 -04:00
parent 92d0a07168
commit f490206538
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
2 changed files with 19 additions and 0 deletions

5
src/stdext/dune Normal file
View file

@ -0,0 +1,5 @@
(library
(name trace_stdext)
(public_name trace.stdext)
(synopsis "standard extensions for trace")
(libraries trace.core))

View file

@ -0,0 +1,14 @@
(** Standard extensions *)
open Trace_core
type extension_event +=
| Link of explicit_span * explicit_span_ctx
(** [Link (span, ctx)] establishes a link between two spans (one of which is
only known by context). The link is not a parent-child link, but a causality/relatedness link.
Each collector is free to interpret this as it wishes. *)
(** Link two spans together. *)
let[@inline] link (es:explicit_span) (ctx:explicit_span_ctx) : unit =
Trace_core.extension_event (Link (es, ctx))