Module Octez_telemetry.Traceparent

type t

A traceparent describes the position of the incoming request in its trace graph in a portable, fixed-length format.

See https://www.w3.org/TR/trace-context/#design-overview

type 'a instrumented = {
  1. origin : t option;
  2. data : 'a;
}

A piece of data with an attached origin from distributed trace graph.

val to_string : t -> string
val from_string : string -> (t, string) Stdlib.result
val from_scope : Opentelemetry.Scope.t -> t

from_scope scope constructs a traceparent that can be used to link a new span to scope.

val instrument : ?origin:Opentelemetry.Scope.t -> 'a -> 'a instrumented

instrument ?origin x attach a traceparent to provided origin. If origin is omitted, the current scope from the ambient context is used.

val current : unit -> t option

current () returns the traceparent identifiying the current scope from the ambient context.

val propagate : ?service_name:string -> ?attrs:('a -> (string * Opentelemetry.value) Tezos_base.TzPervasives.trace) -> ?kind:Opentelemetry_proto.Trace.span_span_kind -> ?links:Opentelemetry_proto.Trace.span_link Tezos_base.TzPervasives.trace -> span_name:('a -> string) -> 'a instrumented -> (Opentelemetry.Scope.t -> 'a -> 'b Lwt.t) -> 'b Lwt.t

propagate span_name x k creates a span for the execution of k x.data.