Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Latest commit

 

History

History
117 lines (66 loc) · 2.88 KB

File metadata and controls

117 lines (66 loc) · 2.88 KB

Module oc_stat_measure

Measure represents a type of metric to be tracked and recorded.

Description

For example, latency, request Mb/s, and response Mb/s are measures to collect from a server.

Measure is a generic interface for recording values in aggregations via subscribed views. When recording a value, we have to obtain the list of all subscribed views and call respective aggregations. We use code generation to optimize this. When a view subscribed or unsubscribed we regenerate unrolled loop in a special module (one for each measure). Module names generated from measurement names (1-to-1). If we know a measure name at the compile time, we can eliminate the module name lookup and inject remote call directly, replacing oc_stat:record with <GENERATED_MEASURE_MODULE>:record. For that {parse_transform, oc_stat_measure} option must be used.

Data Types


description() = binary() | string()

measure() = #measure{name = name(), module = module(), description = description(), unit = unit()}

name() = atom() | binary() | string()

unit() = atom()

Function Index

exists/1 Returns a measure with the Name or false..
new/3 Creates and registers a measure.
unit/1

Function Details

exists/1


exists(Measure::name() | measure()) -> measure() | false

Returns a measure with the Name or false..

new/3


new(Name::name(), Description::description(), Unit::unit()) -> oc_stat_view:measure()

Creates and registers a measure. If a measure with the same name already exists, old measure returned.

unit/1


unit(Measure::measure()) -> unit()