From e001d62fd53fa30d79de3befa25d855dd8201c63 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Mon, 12 Feb 2024 14:00:51 -0500 Subject: [PATCH] add Scope.to_span_ctx --- src/core/opentelemetry.ml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/opentelemetry.ml b/src/core/opentelemetry.ml index 48704adf..dd287d2b 100644 --- a/src/core/opentelemetry.ml +++ b/src/core/opentelemetry.ml @@ -672,6 +672,10 @@ module Scope = struct 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. Note that this takes a function that produces an event, and will only