Collects Cowboy metrics using metrics stream handler .
-
cowboy_early_errors_total
Type: counter.
Labels: default -[]
, configured viaearly_errors_labels
.
Total number of Cowboy early errors, i.e. errors that occur before a request is received. -
cowboy_protocol_upgrades_total
Type: counter.
Labels: default -[]
, configured viaprotocol_upgrades_labels
.
Total number of protocol upgrades, i.e. when http connection upgraded to websocket connection. -
cowboy_requests_total
Type: counter.
Labels: default -[method, reason, status_class]
, configured viarequest_labels
.
Total number of Cowboy requests. -
cowboy_spawned_processes_total
Type: counter.
Labels: default -[method, reason, status_class]
, configured viarequest_labels
.
Total number of spawned processes. -
cowboy_errors_total
Type: counter.
Labels: default -[method, reason, error]
, configured viaerror_labels
.
Total number of Cowboy request errors. -
cowboy_request_duration_seconds
Type: histogram.
Labels: default -[method, reason, status_class]
, configured viarequest_labels
.
Buckets: default -[0.01, 0.1, 0.25, 0.5, 0.75, 1, 1.5, 2, 4]
, configured viaduration_buckets
.
Cowboy request duration. -
cowboy_receive_body_duration_seconds
Type: histogram.
Labels: default -[method, reason, status_class]
, configured viarequest_labels
.
Buckets: default -[0.01, 0.1, 0.25, 0.5, 0.75, 1, 1.5, 2, 4]
, configured viaduration_buckets
.
Request body receiving duration.
Prometheus Cowboy2 instrumenter configured via cowboy_instrumenter
key of prometheus
app environment.
Default configuration:
{prometheus, [
...
{cowboy_instrumenter, [{duration_buckets, [0.01, 0.1, 0.25, 0.5,
0.75, 1, 1.5, 2, 4]},
{early_error_labels, []},
{request_labels, [method, reason, status_class]},
{error_labels, [method, reason, error]},
{registry, default}]}
...
]}
Builtin:
- host,
- port,
- method,
- status,
- status_class,
- reason,
- error.
can be implemented via module exporting label_value/2 function.
First argument will be label name, second is Metrics data from
metrics stream handler
.
Set this module to labels_module
configuration option.
observe/1 | Metrics stream handler callback. |
setup/0 | Sets all metrics up. |
observe(Metrics0::map()) -> ok
Metrics stream handler callback.
setup() -> any()
Sets all metrics up. Call this when the app starts.