elli-lib / elli_prometheus

Elli middleware for collecting stats via Prometheus.
https://github.com/elli-lib/elli_prometheus/blob/master/doc/elli_prometheus.md
Other
14 stars 8 forks source link

Use metric:declare to tolerate elli restart #1

Closed deadtrickster closed 8 years ago

deadtrickster commented 8 years ago

Hey!

So when supervisor restarts elli elli_startup event is generated and prometheus_<metric>:new/1,2 would be called now. The 'problem' is prometheus_<metric>:new/1,2 really expects non-existent metric! For restarts-friendly use-cases there is prometheus_<metric>:declare/1,2 which is basically the same as prometheus_<metric>:new/1,2 except it is ok if metric already exists.

yurrriq commented 8 years ago

Awesome. Thank you!