package opentelemetry

  1. Overview
  2. Docs

Traces.

See the spec

type span = Span.t
val make_resource_spans : ?service_name:string -> ?attrs: (string * [< `Bool of bool | `Int of int | `None | `String of string ]) list -> Proto.Trace.span list -> Proto.Trace.resource_spans
val emit : ?service_name:string -> ?attrs: (string * [< `Bool of bool | `Int of int | `None | `String of string ]) list -> span list -> unit

Sync emitter.

This instructs the collector to forward the spans to some backend at a later point.

NOTE be careful not to call this inside a Gc alarm, as it can cause deadlocks.

type scope = Scope.t = {
  1. trace_id : Trace_id.t;
  2. span_id : Span_id.t;
  3. mutable events : Event.t list;
  4. mutable attrs : Span.key_value list;
}
  • deprecated use Scope.t
val add_event : Scope.t -> (unit -> Event.t) -> unit
  • deprecated use Scope.add_event
val add_attrs : Scope.t -> (unit -> key_value list) -> unit
  • deprecated use Scope.add_attrs
val with_ : ?force_new_trace_id:bool -> ?trace_state:string -> ?service_name:string -> ?attrs:(string * value) list -> ?kind:Span.kind -> ?trace_id:Trace_id.t -> ?parent:Span.id -> ?scope:Scope.t -> ?links:Span_link.t list -> string -> (Scope.t -> 'a) -> 'a

Sync span guard.

  • parameter force_new_trace_id

    if true (default false), the span will not use a surrounding context, or scope, or trace_id, but will always create a fresh new trace ID.

    NOTE be careful not to call this inside a Gc alarm, as it can cause deadlocks.

OCaml

Innovation. Community. Security.