Module oc_stat_view
View allows users to aggregate the recorded Measurements.
Description
Views need to be passed to the subscribe function to be before data will be collected and sent to exporters.
Data Types
description()
description() = binary() | string()
name()
name() = atom() | binary() | string()
view()
view() = #view{name = name() | _, measure = measure_name() | _, subscribed = boolean(), description = description() | _, ctags = oc_tags:tags() | _, tags = [oc_tags:key()] | _, aggregation = aggregation() | _, aggregation_options = aggregation_options() | _}
view_data()
view_data() = #{name => name(), description => description(), ctags => oc_tags:tags(), tags => [oc_tags:key()], data => oc_stat_aggregation:data()}
Function Index
'__init_backend__'/0 | |
code_change/3 | |
deregister/1 | Deregisters the view. |
export/1 | Returns a snapshot of the View's data. |
handle_call/3 | |
handle_cast/2 | |
handle_info/2 | |
init/1 | |
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. |
preload/1 |
Loads and subscribes views from the List in one shot. |
register/1 | Registers the view. |
register/5 | Registers the view created from arguments. |
start_link/0 | |
subscribe/1 | Subscribe the View, When subscribed, a view can aggregate measure data and export it. |
subscribe/5 | A shortcut. |
terminate/2 | |
unsubscribe/1 | Unsubscribes the View. |
Function Details
'init_backend'/0
__init_backend__() -> any()
code_change/3
code_change(OldVsn, State, Extra) -> any()
deregister/1
deregister(View::name() | view()) -> ok
Deregisters the view. If subscribed, unsubscribes and therefore existing aggregation data cleared.
export/1
export(View::view()) -> view_data()
Returns a snapshot of the View's data.
handle_call/3
handle_call(X1, From, State) -> any()
handle_cast/2
handle_cast(X1, State) -> any()
handle_info/2
handle_info(X1, State) -> any()
init/1
init(Args) -> any()
is_registered/1
is_registered(View::name() | view()) -> boolean()
Returns true if the view is registered.
is_subscribed/1
is_subscribed(View::name() | view()) -> boolean()
Returns true if the view is exporting data by subscription.
new/1
new(Map) -> any()
Creates a View from a map.
new/5
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.
preload/1
preload(List) -> any()
Loads and subscribes views from the List
in one shot. Usually used for loading views from configuration on app start.
register/1
register(View::view()) -> {ok, view()} | {error, any()}
Registers the view. Aggregation initialized with AggregationOptions.
register/5
register(Name, Measure, Description, Tags, Aggregation) -> any()
Registers the view created from arguments.
start_link/0
start_link() -> any()
subscribe/1
subscribe(View::name() | view()) -> {ok, view()} | {error, any()}
Subscribe the View, When subscribed, a view can aggregate measure data and export it.
subscribe/5
subscribe(Name, Measure, Description, Tags, Aggregation) -> any()
A shortcut. Creates, Registers, and Subscribes a view in one call.
terminate/2
terminate(X1, X2) -> any()
unsubscribe/1
unsubscribe(View::name() | view()) -> ok
Unsubscribes the View. When unsubscribed a view no longer aggregates measure data and exports it. Also all existing aggregation data cleared.