mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-05-05 17:04:52 -04:00
docs
This commit is contained in:
parent
5f3b162290
commit
59e2e854e5
1 changed files with 11 additions and 0 deletions
|
|
@ -1,6 +1,9 @@
|
||||||
open Common_
|
open Common_
|
||||||
|
|
||||||
module Extensions = struct
|
module Extensions = struct
|
||||||
|
(* extend [Trace]'s types with OTEL specific variants, eg to have a
|
||||||
|
[Trace.span] be a wrapper around [OTEL.Span.t], or to declare custom actions
|
||||||
|
to link spans together, or to be able to use [OTEL]-specific metrics types *)
|
||||||
type Trace.span += Span_otel of OTEL.Span.t
|
type Trace.span += Span_otel of OTEL.Span.t
|
||||||
|
|
||||||
type Trace.extension_event +=
|
type Trace.extension_event +=
|
||||||
|
|
@ -21,6 +24,14 @@ end
|
||||||
|
|
||||||
open Extensions
|
open Extensions
|
||||||
|
|
||||||
|
(* Inject ambient span into [Trace], relying on the [Ambient_context]
|
||||||
|
library. We use the generic ambient context to carry a [Hmap.t] around with
|
||||||
|
possible the current [Trace.span], and it is also used by [OTEL] itself
|
||||||
|
(ambient [OTEL.Span_ctx.t]).
|
||||||
|
|
||||||
|
This mechanism is used by [Trace] so that nested [Trace.with_span] can infer
|
||||||
|
the correct parent-child relation from implicit context, and produce OTEL
|
||||||
|
spans accordingly; without it every span would be parentless. *)
|
||||||
module Ambient_span_provider_ = struct
|
module Ambient_span_provider_ = struct
|
||||||
let get_current_span () =
|
let get_current_span () =
|
||||||
match OTEL.Ambient_span.get () with
|
match OTEL.Ambient_span.get () with
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue