package metrics

  1. Overview
  2. Docs
On This Page
  1. Data
Legend:
Library
Module
Module type
Parameter
Class
Class type

Data defines what is stored in the time series.

Data

Metric's data points are a list of typed fields with an optional timestamp. They are created with the v and field constructors.

For instance, to create a data point with two values "%CPU" and "MEM", respectively of type float and int:

let x = Data.v [ float "%CPU" 0.42; int "MEM" 27_000 ] 
type t

The type for data points.

type timestamp = string

The type for timestamp. A timestamp shows the date and time, in RFC3339 UTC, associated with particular data.

val timestamp : t -> timestamp option

timestamp t is t's timestamp (if any). If it is None, then the reporter will add a new timestamp automatically.

val v : ?timestamp:timestamp -> field list -> t

v ?timestamp f is the measure f, as a the list metric name and value, and the timestamp timestamp. If timestamp is not provided, it will be set be the reporter. Raise Invalid_argument is a key or a value contains an invalid character.

val keys : t -> key list

keys t is t's keys.

val fields : t -> field list

fields t is t's fields.

val cons : field -> t -> t

cons f t is the new data having the same timestamp as t and the fields f :: fields t.

OCaml

Innovation. Community. Security.