package trace

  1. Overview
  2. Docs

Module TraceSource

Trace.

Sourcetype span = int64

A span identifier.

Sourcetype user_data = [
  1. | `Int of int
  2. | `String of string
  3. | `Bool of bool
  4. | `None
]

User defined data, generally passed as key/value pairs

Sourcemodule Collector : sig ... end

A global collector.

Tracing

Sourceval enabled : unit -> bool

Is there a collector?

This is fast, so that the traced program can check it before creating any span or message

Sourceval enter_span : ?__FUNCTION__:string -> __FILE__:string -> __LINE__:int -> ?data:(unit -> (string * user_data) list) -> string -> span
Sourceval exit_span : span -> unit
Sourceval with_span : ?__FUNCTION__:string -> __FILE__:string -> __LINE__:int -> ?data:(unit -> (string * user_data) list) -> string -> (span -> 'a) -> 'a
Sourceval message : ?span:span -> ?data:(unit -> (string * user_data) list) -> string -> unit
Sourceval messagef : ?span:span -> ?data:(unit -> (string * user_data) list) -> ((('a, Format.formatter, unit, unit) format4 -> 'a) -> unit) -> unit
Sourceval set_thread_name : string -> unit

Give a name to the current thread.

Sourceval set_process_name : string -> unit

Give a name to the current process.

Sourceval counter_int : string -> int -> unit

Emit a counter (int)

Sourceval counter_float : string -> float -> unit

Emit a counter (float)

Collector

Sourcetype collector = (module Collector.S)
Sourceval setup_collector : collector -> unit

setup_collector c installs c as the collector.

Sourceval shutdown : unit -> unit