package trace

  1. Overview
  2. Docs
A stub for tracing/observability, agnostic in how data is collected

Install

Dune Dependency

Authors

Maintainers

Sources

trace-0.10.tbz
sha256=c5a43827bbd5521e779c8856e44f4c718dccda902d00a242b598516110ada04d
sha512=f19cb25a767ed428cb1d4a497312267524bfaaf9550caa5fc1e84809494f0b7eaf26030d95563c75dea66606fcbec1be7e34baa4cba86fc57d64bc5d5b98efd5

doc/trace.subscriber/Trace_subscriber/Callbacks/index.html

Module Trace_subscriber.CallbacksSource

Callbacks used for subscribers.

Each subscriber defines a set of callbacks, for each possible tracing event. These callbacks take a custom state that is paired with the callbacks in Subscriber.t.

To use a default implementation for some callbacks, use:

  module My_callbacks = struct
    type st = …

    include Trace_subscriber.Callbacks.Dummy

    let on_init (state:st) ~time_ns : unit = …

    (* … other custom callbacks … *)
  end

NOTE: the trace_id passed alongside manual spans is guaranteed to be at least 64 bits.

Sourcemodule type S = sig ... end

First class module signature for callbacks

Sourcetype 'st t = (module S with type st = 'st)

Callbacks for a subscriber. There is one callback per event in Trace. The type 'st is the state that is passed to every single callback.

Sourcemodule Dummy : sig ... end

Dummy callbacks. It can be useful to reuse some of these functions in a real subscriber that doesn't want to handle all events, but only some of them.

Sourceval dummy : unit -> 'st t

Dummy callbacks, ignores all events.

OCaml

Innovation. Community. Security.