Opentelemetry_core.SpanSpans.
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.ttype kind = Span_kind.t = type key_value = Key_value.tval pp : Stdlib.Format.formatter -> t -> unitval make :
?kind:kind ->
?trace_state:string ->
?attrs:key_value list ->
?events:Event.t list ->
?status:Opentelemetry_core.Common_.Proto.Trace.status ->
trace_id:Trace_id.t ->
id:Span_id.t ->
?parent:id ->
?links:Span_link.t list ->
start_time:Timestamp_ns.t ->
end_time:Timestamp_ns.t ->
string ->
tmake ~trace_id ~id name creates a new span
val trace_id : t -> Trace_id.tval is_not_dummy : t -> boolval dummy : tDummy span, will not record anything
val create_new :
?kind:kind ->
?id:Span_id.t ->
?trace_state:string ->
?attrs:key_value list ->
?events:Event.t list ->
?status:Opentelemetry_core.Common_.Proto.Trace.status ->
trace_id:Trace_id.t ->
?parent:id ->
?links:Span_link.t list ->
start_time:Timestamp_ns.t ->
end_time:Timestamp_ns.t ->
string ->
tval attrs : t -> Key_value.t listval links : t -> Span_link.t listval status : t -> Span_status.t optionval kind : t -> Span_kind.t optionval to_span_link : t -> Span_link.tTurn the scope into a span link
val to_span_ctx : t -> Span_ctx.tTurn the scope into a span context
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 record_exception : t -> exn -> Stdlib.Printexc.raw_backtrace -> unitRecord an exception occurring inside the span. This creates a span event and also sets the span status to error.
val add_links : t -> Span_link.t list -> unitval add_links' : t -> (unit -> Span_link.t list) -> unitAdd links to the scope. It will be aggregated into the span.
Note that this takes a function that produces links, and will only call it if there is an instrumentation backend.
val add_attrs : t -> Key_value.t list -> unitval add_attrs' : t -> (unit -> Key_value.t list) -> unitval set_status : t -> Span_status.t -> unitset the span status.
Note that this function will be called only if there is an instrumentation backend.
val set_kind : t -> Span_kind.t -> unitSet the span's kind.
val default_kind : Span_kind.t refDefault span kind in make and create_new.
This will be used in all spans that do not specify ~kind explicitly; it is set to "internal", following directions from the .proto file. It can be convenient to set "client" or "server" uniformly in here.
val k_ambient : t Context.keyContext key to carry around a Span.t in ambient context.