The CDP preparation scratch area. The 'value' field should be accumulated in such a way that it always contains the value that will eventually be the CDP. This means that for averages, we accumulate 1/n * the PDP, and renormalise when we have unknown PDPs. For the other types it's much easier
type cdp_prep = {
mutable cdp_value : float;
mutable cdp_unknown_pdps : int;
(*
How may PDPs have been unknown so far
*)
}
DS - a data source This defines how we deal with incoming data. Type is one of:
Absolute: meaning that the incoming data is an absolute rate
Derive: meaning that the rate must come from the difference between the incoming data and the previous value
Gauge: meaning that the value isn't a rate at all (e.g. temperature, load avg)
Optionally, there is a maximum time greater than which we mark the PDPs as unknown.
RRA - RRD archive This is an archive that holds consolidated data points (CDPs) belonging to a single consolidation function. They are stored in rings buffers, each one related to a single different data-source. It defines the type of consolidation that happens (average, max, min or last), the number of primary data points (PDPs) that go to make a CDP, and the number of CDPs to store.
To better visualize how the datapoints are stored:
│ Datasources ┃ ┃ ┃ └─────────────────┨ Memory ┃ cputime ┃ Consolidators ┃ ┃ ┃ ━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━┫ Average ┃ Fring of CDPs ┃ Fring of CDPs ┃ ← RRA ━━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━━━━┫ Max ┃ Fring of CDPs ┃ Fring of CDPs ┃ ← RRA ━━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━━━━┛
val ds_create :
string ->ds_type->?min:float ->?max:float ->?mrhb:float ->ds_value_type->ds
val rrd_create : ds array->rra array->int64 ->float ->rrd
Add in a new DS into a pre-existing RRD. Preserves data of all the other archives and fills the new one full of NaNs. Note that this doesn't fill in the CDP values correctly at the moment!
Remove the named DS from an RRD. Removes all of the data associated with it, too
val find_best_rras : rrd->int ->cf_type option->int64 ->rra list
Find the RRA with a particular CF that contains a particular start time, and also has a minimum pdp_cnt. If it can't find an appropriate one, either return the RRA with the correct CF that has the most ancient data, or raise No_RRA_Available if there's not archive with the correct CF. Assumes the RRAs are stored in increasing time-length
val query_named_ds : rrd->float ->string ->cf_type-> float