Opentelemetry.Trace_providerval get : unit -> Tracer.tGet current tracer.
val set : Tracer.t -> unitSet current tracer
Replace current tracer by the dummy one. All spans will be discarded from now on.
val get_tracer :
?name:string ->
?version:string ->
?attrs:(string * [< Opentelemetry_core.Value.t ]) list ->
?__MODULE__:string ->
unit ->
Tracer.tGet a tracer pre-configured with a fixed set of attributes added to every span it emits, forwarding to the current global tracer. Intended to be called once at the top of a library module.
val default_tracer : Tracer.tA Tracer.t that lazily reads the global at emit time
val emit : Opentelemetry_core.Span.t -> unitEmit a span directly via the current global tracer
val with_thunk_and_finally :
Tracer.t ->
?force_new_trace_id:bool ->
?trace_state:string ->
?attrs:(string * Opentelemetry_core.Value.t) list ->
?kind:Opentelemetry_core.Span.kind ->
?trace_id:Opentelemetry_core.Trace_id.t ->
?parent:Opentelemetry_core.Span.t ->
?links:Opentelemetry_core.Span_link.t list ->
string ->
(Opentelemetry_core.Span.t -> 'a) ->
(unit -> 'a) * ((unit, exn * Stdlib.Printexc.raw_backtrace) result -> unit)Helper to implement with_ and similar functions
val with_ :
?tracer:Tracer.t ->
?force_new_trace_id:bool ->
?trace_state:string ->
?attrs:(string * Opentelemetry_core.Value.t) list ->
?kind:Opentelemetry_core.Span.kind ->
?trace_id:Opentelemetry_core.Trace_id.t ->
?parent:Opentelemetry_core.Span.t ->
?links:Opentelemetry_core.Span_link.t list ->
string ->
(Opentelemetry_core.Span.t -> 'a) ->
'aSync span guard.
Notably, this includes implicit scope-tracking: if called without a ~scope argument (or ~parent/~trace_id), it will check in the Ambient_context for a surrounding environment, and use that as the scope. Similarly, it uses Scope.with_ambient_scope to set a new scope in the ambient context, so that any logically-nested calls to with_ will use this span as their parent.
NOTE be careful not to call this inside a Gc alarm, as it can cause deadlocks.