Wobserver v0.1.8 Wobserver.Util.Metrics View Source
Metrics management for custom metrics and generators in wobserver.
Link to this section Summary
Functions
IO metrics
Loads custom metrics and metric generators from configuration and adds them to :wobserver
Memory metrics
Lists all metrics
Registers a metrics or metric generators with :wobserver
Link to this section Functions
IO metrics.
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 metrics or metric generators with :wobserver
.
The metrics
parameter must always be a list of metrics or metric generators.
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
.