Module Opentelemetry.Span

Spans.

A Span is the workhorse of traces, it indicates an operation that took place over a given span of time (indicated by start_time and end_time) as part of a hierarchical trace. All spans in a given trace are bound by the use of the same Trace_id.t.

type id = Span_id.t
type nonrec kind = Proto.Trace.span_span_kind =
  1. | Span_kind_unspecified
  2. | Span_kind_internal
  3. | Span_kind_server
  4. | Span_kind_client
  5. | Span_kind_producer
  6. | Span_kind_consumer
type nonrec status_code = Proto.Trace.status_status_code =
  1. | Status_code_unset
  2. | Status_code_ok
  3. | Status_code_error
type nonrec status = Proto.Trace.status = {
  1. message : string;
  2. code : status_code;
}
val id : t -> Span_id.t
type key_value = string * [ `Int of int | `String of string | `Bool of bool | `Float of float | `None ]
val create : ?kind:kind -> ?id:id -> ?trace_state:string -> ?attrs:key_value list -> ?events:Event.t list -> ?status:status -> trace_id:Trace_id.t -> ?parent:id -> ?links:Span_link.t list -> start_time:Timestamp_ns.t -> end_time:Timestamp_ns.t -> string -> t * id

create ~trace_id name creates a new span with its unique ID.

  • parameter trace_id

    the trace this belongs to

  • parameter parent

    parent span, if any

  • parameter links

    list of links to other spans, each with their trace state (see w3.org)