From f4902065383007d815caf51d71c94925394c8b5e Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Sat, 12 Apr 2025 21:10:03 -0400 Subject: [PATCH] feat: add `trace.stdext`, with standard extensions --- src/stdext/dune | 5 +++++ src/stdext/trace_stdext.ml | 14 ++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 src/stdext/dune create mode 100644 src/stdext/trace_stdext.ml diff --git a/src/stdext/dune b/src/stdext/dune new file mode 100644 index 0000000..f638470 --- /dev/null +++ b/src/stdext/dune @@ -0,0 +1,5 @@ +(library + (name trace_stdext) + (public_name trace.stdext) + (synopsis "standard extensions for trace") + (libraries trace.core)) diff --git a/src/stdext/trace_stdext.ml b/src/stdext/trace_stdext.ml new file mode 100644 index 0000000..4e966f5 --- /dev/null +++ b/src/stdext/trace_stdext.ml @@ -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))