Skip to main content

Prometheus and Grafana Metrics Explained

Here is a diagram to explain how Prometheus and Grafana work to display Web app metrics. In this case using an Express server. But any server in any language that has a Prometheus client package will do.

The high level view

  1. Build into your app calls to the Prometheus client package. The client can do things like count times a user calls your API, adds or removes inventory, etc.
  2. Provide an endpoint that when called returns the client metrics in an output that only a Prometheus server could love
  3. Run a Prometheus server in Docker, Kubernetes etc with a YAML file telling it where your client app is. It will scrape your metrics endpoint for - well, metrics
  4. Access the Prometheus server and query it directly for some marginal graphics, or better
  5. Run a Grafana server in Docker or Kubernetes as well. Build a custom UI that queries the Prometheus server to display the metrics in a nicer, visual form.

References

Open Telemetry

Prometheus

Grafana