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
- 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.
- Provide an endpoint that when called returns the client metrics in an output that only a Prometheus server could love
- 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
- Access the Prometheus server and query it directly for some marginal graphics, or better
- 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.
Related Links
References
Open Telemetry
Prometheus
- Prometheus
- Prometheus Installation
- Prometheus Operator - The Prometheus Operator manages Prometheus clusters atop Kubernetes.
- Prometheus client for node.js