Skip to content

plugins/metrics v0.1.0

Choose a tag to compare

@zombocoder zombocoder released this 12 Jul 17:19
· 8 commits to main since this release
c4c63f0

Prometheus metrics plugin (#35).

Turns @Counter / @Gauge(name=, help=, namespace=, labels=[…]) annotations into a generated file of registered Prometheus collectors: a var per metric, RegisterMetrics(reg), and a typed accessor per metric. For custom/business metrics; complements the automatic per-call @Timed.

Add to goboot.yaml:

plugins:
  - github.com/zombocoder/goboot/plugins/metrics@v0.1.0

then generated.RegisterMetrics(reg) and expose /metrics via promhttp. Requires core v0.1.5 and github.com/prometheus/client_golang in the target module.