diff --git a/trace-tef/Trace_tef/index.html b/trace-tef/Trace_tef/index.html index 232b919..e20aee7 100644 --- a/trace-tef/Trace_tef/index.html +++ b/trace-tef/Trace_tef/index.html @@ -1,5 +1,5 @@ -Trace_tef (trace-tef.Trace_tef)

Module Trace_tef

module Collector_tef : sig ... end
module Exporter : sig ... end

An exporter, takes JSON objects and writes them somewhere

module Writer : sig ... end

Write JSON events to a buffer.

module Types : sig ... end
type output = [
  1. | `Stdout
  2. | `Stderr
  3. | `File of string
]

Output for tracing.

  • `Stdout will enable tracing and print events on stdout
  • `Stderr will enable tracing and print events on stderr
  • `File "foo" will enable tracing and print events into file named "foo"
val collector : out:[< output ] -> unit -> Trace_core.collector

Make a collector that writes into the given output. See setup for more details.

val setup : ?debug:bool -> ?out:[ output | `Env ] -> unit -> unit

setup () installs the collector depending on out.

  • parameter out

    can take different values:

    • regular output value to specify where events go
    • `Env will enable tracing if the environment variable "TRACE" is set.
  • If it's set to "1", then the file is "trace.json".
  • If it's set to "stdout", then logging happens on stdout (since 0.2)
  • If it's set to "stderr", then logging happens on stdout (since 0.2)
  • Otherwise, if it's set to a non empty string, the value is taken to be the file path into which to write.
  • parameter debug

    if true, use Trace_debug. Default false.

val with_setup : +Trace_tef (trace-tef.Trace_tef)

Module Trace_tef

TEF collector for Trace.

This emits chrome traces (https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/), which are very simple and a known quantity.

They can be opened in https://ui.perfetto.dev .

module Collector_tef : sig ... end
module Exporter : sig ... end

An exporter, takes JSON objects and writes them somewhere

module Writer : sig ... end

Write JSON events to a buffer.

module Types : sig ... end
type output = [
  1. | `Stdout
  2. | `Stderr
  3. | `File of string
]

Output for tracing.

  • `Stdout will enable tracing and print events on stdout
  • `Stderr will enable tracing and print events on stderr
  • `File "foo" will enable tracing and print events into file named "foo"
val collector : out:[< output ] -> unit -> Trace_core.collector

Make a collector that writes into the given output. See setup for more details.

val setup : ?debug:bool -> ?out:[ output | `Env ] -> unit -> unit

setup () installs the collector depending on out.

  • parameter out

    can take different values:

    • regular output value to specify where events go
    • `Env will enable tracing if the environment variable "TRACE" is set.
  • If it's set to "1", then the file is "trace.json".
  • If it's set to "stdout", then logging happens on stdout (since 0.2)
  • If it's set to "stderr", then logging happens on stdout (since 0.2)
  • Otherwise, if it's set to a non empty string, the value is taken to be the file path into which to write.
  • parameter debug

    if true, use Trace_debug. Default false.

val with_setup : ?debug:bool -> ?out:[ output | `Env ] -> unit -> diff --git a/trace-tef/index.html b/trace-tef/index.html index 30390d8..2018a4e 100644 --- a/trace-tef/index.html +++ b/trace-tef/index.html @@ -1,2 +1,2 @@ -index (trace-tef.index)

Package trace-tef

Package info

changes-files
readme-files
+index (trace-tef.index)

Package trace-tef

Package info

changes-files
readme-files
diff --git a/trace/Trace/index.html b/trace/Trace/index.html index 79fc206..d28ae6d 100644 --- a/trace/Trace/index.html +++ b/trace/Trace/index.html @@ -1,5 +1,5 @@ -Trace (trace.Trace)

Module Trace

include module type of struct include Trace_core end
type span = Trace_core.span = ..

A span. Its representation is defined by the current collector.

type parent = Trace_core.parent =
  1. | P_unknown
    (*

    Parent is not specified at this point

    *)
  2. | P_none
    (*

    We know the current span has no parent

    *)
  3. | P_some of span
    (*

    We know the parent of the current span

    *)

Information about a span's parent span, if any.

  • since NEXT_RELEASE
type user_data = [
  1. | `Int of int
  2. | `String of string
  3. | `Bool of bool
  4. | `Float of float
  5. | `None
]

User defined data, generally passed as key/value pairs to whatever collector is installed (if any).

type explicit_span = span
  • deprecated use span
type explicit_span_ctx = span
  • deprecated use span
type extension_parameter = Trace_core.extension_parameter = ..

An extension parameter, used to carry information for spans/messages/metrics that can be backend-specific or just not envisioned by trace.

  • since NEXT_RELEASE
module Collector = Trace_core.Collector
module Level = Trace_core.Level

Tracing

val enabled : unit -> bool

Is there a collector?

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

val get_default_level : unit -> Level.t

Current default level for spans.

  • since 0.7
val set_default_level : Level.t -> unit

Set level used for spans that do not specify it. The default default value is Level.Trace.

  • since 0.7
val with_span : +Trace (trace.Trace)

Module Trace

Shim that just forwards to Trace_core.

The reason is, Trace is already defined in the compiler libs and can clash with this module inside a toplevel. So it's safer to only depend on Trace_core in libraries that might end up used in a toplevel.

include module type of struct include Trace_core end
type span = Trace_core.span = ..

A span. Its representation is defined by the current collector.

type parent = Trace_core.parent =
  1. | P_unknown
    (*

    Parent is not specified at this point

    *)
  2. | P_none
    (*

    We know the current span has no parent

    *)
  3. | P_some of span
    (*

    We know the parent of the current span

    *)

Information about a span's parent span, if any.

  • since NEXT_RELEASE
type user_data = [
  1. | `Int of int
  2. | `String of string
  3. | `Bool of bool
  4. | `Float of float
  5. | `None
]

User defined data, generally passed as key/value pairs to whatever collector is installed (if any).

type explicit_span = span
  • deprecated use span
type explicit_span_ctx = span
  • deprecated use span
type extension_parameter = Trace_core.extension_parameter = ..

An extension parameter, used to carry information for spans/messages/metrics that can be backend-specific or just not envisioned by trace.

  • since NEXT_RELEASE
module Collector = Trace_core.Collector
module Level = Trace_core.Level

Tracing

val enabled : unit -> bool

Is there a collector?

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

val get_default_level : unit -> Level.t

Current default level for spans.

  • since 0.7
val set_default_level : Level.t -> unit

Set level used for spans that do not specify it. The default default value is Level.Trace.

  • since 0.7
val with_span : ?level:Level.t -> ?__FUNCTION__:string -> __FILE__:string -> diff --git a/trace/Trace_core/index.html b/trace/Trace_core/index.html index ae5a83c..ca80701 100644 --- a/trace/Trace_core/index.html +++ b/trace/Trace_core/index.html @@ -1,5 +1,5 @@ -Trace_core (trace.Trace_core)

Module Trace_core

Trace.

type span = ..

A span. Its representation is defined by the current collector.

type parent =
  1. | P_unknown
    (*

    Parent is not specified at this point

    *)
  2. | P_none
    (*

    We know the current span has no parent

    *)
  3. | P_some of span
    (*

    We know the parent of the current span

    *)

Information about a span's parent span, if any.

  • since NEXT_RELEASE
type user_data = [
  1. | `Int of int
  2. | `String of string
  3. | `Bool of bool
  4. | `Float of float
  5. | `None
]

User defined data, generally passed as key/value pairs to whatever collector is installed (if any).

type explicit_span = span
  • deprecated use span
type explicit_span_ctx = span
  • deprecated use span
type extension_parameter = ..

An extension parameter, used to carry information for spans/messages/metrics that can be backend-specific or just not envisioned by trace.

  • since NEXT_RELEASE
module Collector : sig ... end

A global collector.

module Level : sig ... end

Tracing levels.

Tracing

val enabled : unit -> bool

Is there a collector?

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

val get_default_level : unit -> Level.t

Current default level for spans.

  • since 0.7
val set_default_level : Level.t -> unit

Set level used for spans that do not specify it. The default default value is Level.Trace.

  • since 0.7
val with_span : +Trace_core (trace.Trace_core)

Module Trace_core

Main tracing interface.

This interface is intended to be lightweight and usable in both libraries and applications. It has very low overhead if no Collector.t is installed.

type span = ..

A span. Its representation is defined by the current collector.

type parent =
  1. | P_unknown
    (*

    Parent is not specified at this point

    *)
  2. | P_none
    (*

    We know the current span has no parent

    *)
  3. | P_some of span
    (*

    We know the parent of the current span

    *)

Information about a span's parent span, if any.

  • since NEXT_RELEASE
type user_data = [
  1. | `Int of int
  2. | `String of string
  3. | `Bool of bool
  4. | `Float of float
  5. | `None
]

User defined data, generally passed as key/value pairs to whatever collector is installed (if any).

type explicit_span = span
  • deprecated use span
type explicit_span_ctx = span
  • deprecated use span
type extension_parameter = ..

An extension parameter, used to carry information for spans/messages/metrics that can be backend-specific or just not envisioned by trace.

  • since NEXT_RELEASE
module Collector : sig ... end

A global collector.

module Level : sig ... end

Tracing levels.

Tracing

val enabled : unit -> bool

Is there a collector?

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

val get_default_level : unit -> Level.t

Current default level for spans.

  • since 0.7
val set_default_level : Level.t -> unit

Set level used for spans that do not specify it. The default default value is Level.Trace.

  • since 0.7
val with_span : ?level:Level.t -> ?__FUNCTION__:string -> __FILE__:string -> diff --git a/trace/Trace_debug/Track_spans/index.html b/trace/Trace_debug/Track_spans/index.html index defb342..9b050d8 100644 --- a/trace/Trace_debug/Track_spans/index.html +++ b/trace/Trace_debug/Track_spans/index.html @@ -1,5 +1,5 @@ -Track_spans (trace.Trace_debug.Track_spans)

Module Trace_debug.Track_spans

type unclosed_spans = {
  1. num : int;
  2. by_name : (string * int) list;
}
val track : +Track_spans (trace.Trace_debug.Track_spans)

Module Trace_debug.Track_spans

Helper to track which spans never get closed.

type unclosed_spans = {
  1. num : int;
  2. by_name : (string * int) list;
}
val track : ?on_lingering_spans:[ `Out of out_channel | `Call of unclosed_spans -> unit ] -> Trace_core.Collector.t -> Trace_core.Collector.t

Modify the enter/exit span functions to track the set of spans that are open, and warn at the end if some are not closed.

implementation notes: for now this uses a regular Hashtbl protected by a mutex, so runtime overhead isn't trivial.

  • parameter on_lingering_spans

    what to do with the non-closed spans

diff --git a/trace/Trace_debug/index.html b/trace/Trace_debug/index.html index 9660146..f8b3bf5 100644 --- a/trace/Trace_debug/index.html +++ b/trace/Trace_debug/index.html @@ -1,2 +1,2 @@ -Trace_debug (trace.Trace_debug)

Module Trace_debug

module Track_spans : sig ... end
+Trace_debug (trace.Trace_debug)

Module Trace_debug

module Track_spans : sig ... end

Helper to track which spans never get closed.

diff --git a/trace/index.html b/trace/index.html index 3ec58a7..4322095 100644 --- a/trace/index.html +++ b/trace/index.html @@ -1,2 +1,2 @@ -index (trace.index)

Package trace

Package info

changes-files
readme-files
+index (trace.index)

Package trace

Package info

changes-files
readme-files