package metrics-lwt

  1. Overview
  2. Docs
On This Page
  1. Metric Monitoring
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Metrics_lwtSource

Lwt monitoring.

The monitoring functions of this module return Lwt threads that proceed only when the metric operation is over, as defined by the current Reporters.

v0.4.1 - homepage

Metric Monitoring

Sourceval add : ('a, 'b) Metrics.src -> ('a -> Metrics.tags) -> ('b -> Metrics.data Lwt.t) -> unit Lwt.t

add src t f adds a new data point to src.

Sourceval run : ('a, ('b, exn) result -> Metrics.Data.t) Metrics.src -> ('a -> Metrics.tags) -> (unit -> 'b Lwt.t) -> 'b Lwt.t

run src f runs f () and records in a new data point the time it took. run will also record the status of the computation, e.g. whether an exception has been raised.

Sourceval rrun : ('a, ('b, [ `Exn of exn | `Error of 'c ]) result -> Metrics.Data.t) Metrics.src -> ('a -> Metrics.tags) -> (unit -> ('b, 'c) result Lwt.t) -> ('b, 'c) result Lwt.t

Same as run but also record if the result is Ok or Error.

Sourceval periodically : (Metrics.field list, unit -> Metrics.data) Metrics.src -> unit

periodically src registers src for periodic collection.

Sourceval init_periodic : ?gc:[ `None | `Quick | `Full ] -> ?logs:bool -> (unit -> unit Lwt.t) -> unit

init_periodic ~gc ~logs sleeper starts a task which Lwt.join sleeper and all registered periodically sources. gc is by default `Full, collecting full GC stats - other options are `None and `Quick. If logs is provided and true (the default), the error and warning count from the Logs library are registered to be periodically reported.

OCaml

Innovation. Community. Security.