#The estatist application#
Copyright (c) 2012 Petr Kozorezov
Authors: Petr Kozorezov ([email protected]
).
[](http://travis-ci.
org/petrkozorezov/estatist)
###Overview##
Estatist is the fast statistics aggregator for erlang applications, based on basho_metrics and est tables. This all allows to reduce perfomance costs, and metric update time to around 1-2 microseconds. As consequence of using ets tables, application can aggregate only from local node.
Workflow is:
- set metrics in config;
- run application;
- update metrics with
estatist:update/2
orestatist:tc_update/2
; - get value by http interface or by
estatist:select/1
.
Also see http interface library estatist_http.
###Make##
You can build with make
, run dialyzer with make dialyzer
, generate docs with make doc
.
###Example##
####Simple##
estatist:start(). estatist:add_metric(online_counter, var, [counter]). estatist:update(online_counter, 1). estatist:select_all().
####Complex##
application:set_env(estatist, metrics, [{online_counter, var, [counter]}, {tests, tbl, [simple_meter, histogram]}, {system, var, [system_info]}]). estatist:start(). estatist:update(online_counter, 1). estatist:tc_update({tests, "lists:seq"}, {lists, seq, [1, 1000]}). estatist:tc_update({tests, "lists:seq"}, {lists, seq, [1, 1000]}). estatist:select([{names, online_counter}, {types, counter}, {params, count}]). estatist:select([{names, online_counter}, {types, counter}]). estatist:select([{names, [online_counter, tests]}]).
####Configuration example##
Configuration complex example from real game server:
{estatist, [ {metrics, [ %% network % online users counter {connections, var, [counter]}, % network requests per second and timings {net_commands, tbl, [histogram, simple_meter]}, % connects per second {connects, var, [simple_meter]}, % disconnects per second {disconnects, var, [simple_meter]}, % disconnects reasons {disconnect_reasons, tbl, [{simple_meter, [{tick, 60000}]}]}, %% DB % player saves per second and timings {player_save, var, [simple_meter, histogram]}, % player loads per second and timingstime {player_load, var, [simple_meter, histogram]}, %% system % system info: CPU, memory and etc {system, var, [memory, system_info]}, % log errors from per modules per minutes {modules_errors, tbl, [{simple_meter, [{tick, 60000}]}]} ]} ]}
####Available metric types modules##
For complete list see estatist_module_*.erl
files.
Just count values.
Params:
- count
Calculate min/max, mean, stddev, percentiles in size
values.
When values count becomes greater than the size, a random elements are replaced.
Options:
- size
Params:
- min
- max
- mean
- count
- stddev
- p50
- p95
- p99
Calculate load average.
Options:
- tick -- LA tick in ms
Params:
- count
- one
- five
- fifteen
Same as meter, but count only estatist:update/2
calls ignoring value.
Some system info.
Params:
- cpu_usage
- uptime
- process_usage
- io_input
- io_output
- process_count
Same as erlang:memory()
.
####License##
Copyright (c) 2012 Petr Kozorezov Authors: Petr Kozorezov [email protected] The contents of this file are subject to the Erlang Public License, Version 1.1, (the "License"); you may not use this file except in compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License.
##Modules##
estatist |