PusherServer.Metrics (pusher_server v0.1.2)

Copy Markdown View Source

Counters and a Prometheus-format exporter for one instance.

Turn it on with metrics: true (or PUSHER_METRICS=true) and scrape GET /metrics. Set :metrics_token (PUSHER_METRICS_TOKEN) to require an Authorization: Bearer <token> header. Without a token the endpoint is open to anyone who can reach the port, so block /metrics at your proxy.

Counters are per node and reset when the node restarts, which is what Prometheus expects (rate() handles resets). With several nodes, scrape each one.

Summary

Functions

Current value of a counter.

Adds n to a counter. A no-op when the instance has no counters (e.g. in unit tests).

Renders every counter and gauge in the Prometheus text exposition format.

Functions

get(name, key)

Current value of a counter.

incr(name, key, n \\ 1)

Adds n to a counter. A no-op when the instance has no counters (e.g. in unit tests).

render(name)

Renders every counter and gauge in the Prometheus text exposition format.