package opentelemetry-lwt

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
include module type of struct include Opentelemetry.Trace end

Traces.

See the spec

val make_resource_spans : ?service_name:string -> ?attrs: (string * [< `Bool of bool | `Float of float | `Int of int | `None | `String of string ]) list -> Opentelemetry.Proto.Trace.span list -> Opentelemetry.Proto.Trace.resource_spans
val emit : ?service_name:string -> ?attrs: (string * [< `Bool of bool | `Float of float | `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 = Opentelemetry.Scope.t = {
  1. trace_id : Opentelemetry.Trace_id.t;
  2. span_id : Opentelemetry.Span_id.t;
  3. mutable events : Opentelemetry.Event.t list;
  4. mutable attrs : Opentelemetry.Span.key_value list;
}
  • deprecated use Scope.t
val add_event : Opentelemetry.Scope.t -> (unit -> Opentelemetry.Event.t) -> unit
  • deprecated use Scope.add_event
val add_attrs : Opentelemetry.Scope.t -> (unit -> Opentelemetry.key_value list) -> unit
  • deprecated use Scope.add_attrs
val with_' : ?force_new_trace_id:bool -> ?trace_state:string -> ?service_name:string -> ?attrs:(string * Opentelemetry.value) list -> ?kind:Opentelemetry.Span.kind -> ?trace_id:Opentelemetry.Trace_id.t -> ?parent:Opentelemetry.Span.id -> ?scope:Opentelemetry.Scope.t -> ?links:Opentelemetry.Span_link.t list -> string -> (scope -> 'a) -> (unit -> 'b) * ((unit, string * Stdlib.Printexc.raw_backtrace) Stdlib.result -> unit)

Sync 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.

  • parameter force_new_trace_id

    if true (default false), the span will not use a ambient scope, the ~scope argument, nor ~trace_id, but will instead always create fresh identifiers for this span

val with_ : ?force_new_trace_id:bool -> ?trace_state:string -> ?service_name:string -> ?attrs:(string * Opentelemetry.value) list -> ?kind:Opentelemetry.Span.kind -> ?trace_id:Opentelemetry.Trace_id.t -> ?parent:Opentelemetry.Span.id -> ?scope:Opentelemetry.Scope.t -> ?links:Opentelemetry.Span_link.t list -> string -> (Opentelemetry.Scope.t -> 'a Lwt.t) -> 'a0 Lwt.t

Sync span guard

OCaml

Innovation. Community. Security.