package metrics

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

Module Metrics.DataSource

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 ] 
Sourcetype t

The type for data points.

Sourcetype timestamp = string

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

Sourceval 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.

Sourceval 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.

Sourceval keys : t -> key list

keys t is t's keys.

Sourceval fields : t -> field list

fields t is t's fields.

Sourceval 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.