Module Opentelemetry_emitter.EmitterSource

Emitters.

This is the composable abstraction we use to represent how signals are emitted, from their origin point (a site in user code or library code that was instrumented, and just created a span or log record or metric), down to the actual SDK exporter installed in the application.

Sourceexception Closed
Sourcetype -'a t = {
  1. signal_name : string;
    (*

    Description of what signal is emitted

    *)
  2. enabled : unit -> bool;
    (*

    Return true if emit has a chance of doing something with the signals it's given.

    *)
  3. emit : 'a list -> unit;
    (*

    Emit signals.

    • raises Closed

      if the emitter is closed.

    *)
  4. tick : mtime:Mtime.t -> unit;
    (*

    Call regularly to ensure background work is done. The current monotonic timestamp is passed to improve testability.

    *)
  5. closed : unit -> bool;
    (*

    True if the emitter is already closed. Beware TOCTOU bugs.

    *)
  6. flush_and_close : unit -> unit;
    (*

    Flush internally buffered signals, then close.

    *)
  7. self_metrics : now:Opentelemetry_util.Timestamp_ns.t -> unit -> Opentelemetry_proto.Metrics.metric list;
    (*

    metrics about the emitter itself.

    *)
}

An emitter for values of type 'a.

Sourceval enabled : 'a t -> bool
Sourceval emit : 'a t -> 'a list -> unit
Sourceval tick : 'a t -> mtime:Mtime.t -> unit
Sourceval closed : 'a t -> bool
Sourceval flush_and_close : 'a t -> unit
Sourceval map : ('a -> 'b) -> 'b t -> 'a t

map f emitter returns a new emitter that applies f to signals item-wise before passing them to emitter

Sourceval flat_map : ('a list -> 'b list) -> 'b t -> 'a t

map_l f emitter applies f to incoming lists of signals, and emits the resulting list (if non empty)

Sourceval tap : ('a -> unit) -> 'a t -> 'a t

tap f e is like e, but every signal is passed to f

Sourceval make : ?tick:??? -> ?closed:??? -> ?enabled:??? -> ?flush_and_close:??? -> ?self_metrics:??? -> signal_name:string -> emit:('a list -> unit) -> unit -> 'a t

make ~emit () is an emitter that calls emit.

Sourceval dummy : 'a t

Dummy emitter, doesn't accept or emit anything.