Prometheus metrics

Prometheus uses a pull model in which a service exposes text-formatted metrics through an endpoint such as /metrics. A Prometheus server periodically scrapes that endpoint, while the client_golang promhttp.Handler serves the registered metrics.

Minimal example

go
r.Handle("/metrics", promhttp.Handler())

Learn this concept

Lesson 6.3 · Prometheus metric registration

Used in exercises

Exercise 6.4 · API and worker metrics Exercise 6.16 · Histogram quantile utility
Prerequisite conceptsHTTP handlerChi router