View allows users to aggregate the recorded Measurements.
Views need to be passed to the subscribe function to be before data will be collected and sent to exporters.
aggregation() = module()
aggregation_options() = any()
description() = binary() | string()
measure_name() = atom() | binary() | string()
name() = atom() | binary() | string()
view() = #view{name = name() | _, measure = oc_stat_measure:measure() | measure_name() | _, unit = oc_stat_measure:unit(), subscribed = boolean(), description = description() | _, ctags = oc_tags:tags() | _, tags = [oc_tags:key()] | _, aggregation = aggregation() | _, aggregation_options = aggregation_options() | _}
view_data() = #{name => name(), description => description(), ctags => oc_tags:tags(), tags => [oc_tags:key()], data => oc_stat_aggregation:data()}
| deregister/1 | Deregisters the view. |
| export/1 | Returns a snapshot of the View's data. |
| is_registered/1 | Returns true if the view is registered. |
| is_subscribed/1 | Returns true if the view is exporting data by subscription. |
| new/1 | Creates a View from a map. |
| new/5 | Creates a View. |
| new/6 | |
| register/1 | Registers the view. |
| register/5 | Registers the view created from arguments. |
| register/6 | |
| subscribe/1 | Subscribe the View, When subscribed, a view can aggregate measure data and export it. |
| subscribe/5 | A shortcut: Creates, Registers, and Subscribes a view in one call. |
| subscribe/6 | |
| unsubscribe/1 | Unsubscribes the View. |
Deregisters the view. If subscribed, unsubscribes and therefore existing aggregation data cleared.
Returns {error, {unknown_view, Name}} if the view is unknown.
export(View::view()) -> view_data()
Returns a snapshot of the View's data.
Returns true if the view is registered.
Returns true if the view is exporting data by subscription.
new(Map) -> any()
Creates a View from a map.
new(Name, Measure, Description, Tags, Aggregation) -> any()
Creates a View. This view needs to be registered and subscribed to a measure in order to start aggregating data.
new(Name, Measure, Unit, Description, Tags, Aggregation) -> any()
Registers the view. Aggregation initialized with AggregationOptions.
Returns {error, {unknown_measure, Measure}} if Measure is unknown.
Returns {error, {view_already_exists, Name}} if a
view with Name already registered.
register(Name, Measure, Description, Tags, Aggregation) -> any()
Registers the view created from arguments.
Returns {error, {unknown_measure, Measure}} if Measure is unknown.
Returns {error, {view_already_exists, Name}} if a
view with Name already registered.
register(Name, Measure, Unit, Description, Tags, Aggregation) -> any()
Subscribe the View, When subscribed, a view can aggregate measure data and export it.
Returns {error, {unknown_view, Name}} if Name view is unknown.
subscribe(Name, Measure, Description, Tags, Aggregation) -> any()
A shortcut: Creates, Registers, and Subscribes a view in one call.
Returns {error, {unknown_measure, Measure}} if Measure is unknown.
subscribe(Name, Measure, Unit, Description, Tags, Aggregation) -> any()
Unsubscribes the View. When unsubscribed a view no longer aggregates measure data and exports it. Also all existing aggregation data cleared.
Returns {error, {unknown_view, Name}} if Name view is unknown.