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

type scope = {
  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;
}

Scope to be used with with_.

val add_event : scope -> (unit -> Event.t) -> unit

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 call it if there is an instrumentation backend.

val add_attrs : scope -> (unit -> Span.key_value list) -> unit

Add an attr to the scope. It will be aggregated into the span.

Note that this takes a function that produces attributes, and will only call it if there is an instrumentation backend.

val with_ : ?trace_state:string -> ?service_name:string -> ?attrs:(string * value) list -> ?kind:Span.kind -> ?trace_id:Trace_id.t -> ?parent:Span.id -> ?scope:scope -> ?links:(Trace_id.t * Span_id.t * string) list -> string -> (scope -> 'a) -> 'a

Sync span guard

OCaml

Innovation. Community. Security.