Wobserver v0.1.3 Wobserver.Util.Metrics
Metrics management for custom metrics and generators in wobserver.
Summary
Functions
IO metrics
Loads custom metrics and metric generators from configuration and adds them to :wobserver
Memory metrics
Lists all metrics
Registers a metric or metric generator with :wobserver
Functions
Loads custom metrics and metric generators from configuration and adds them to :wobserver
.
To add custom metrics set the :metrics
option.
The :metrics
option must be a keyword list with the following keys:
additional
, for a keyword list with additional metrics.generators
, for a list of metric generators.
For more information and types see: Wobserver.Util.Metrics.register/1
.
Example:
config :wobserver,
metrics: [
additional: [
example: {fn -> [red: 5] end, :gauge, "Description"},
],
generators: [
"&MyApp.generator/0",
fn -> [bottles: {fn -> [wall: 8, floor: 10] end, :gauge, "Description"}] end
fn -> [server: {"MyApp.Server.metrics/0", :gauge, "Description"}] end
]
]
Memory metrics.
Lists all metrics.
Every generator is called and the generated metrics are merged into the result.
Registers a metric or metric generator with :wobserver
.
Returns true if succesfully added. (otherwise false)
The following inputs are accepted for metrics:
keyword
list, the key is the name of the metric and the value is the metric data.
The following inputs are accepted for metric generators:
list
of callable functions. Every function should return a keyword list with as key the name of the metric and as value the metric data.
For more information about how to format metric data see: Wobserver.Util.Metrics.Formatter.format_all/1
.