To set up metrics with Prometheus, we need to understand how the process works. Its key component is that each service that's measured has its own Prometheus client that keeps track of the metrics. The data in the Prometheus server will be available for a Grafana service that will plot the metrics.
The following diagram shows the general architecture:
The Prometheus server pulls information at regular intervals. This method of operation is very lightweight since registering metrics just updates the local memory of the service and scales well. On the other hand, it shows sampled data at certain times and doesn't register each individual event. This has certain implications in terms of storing and representing data and imposes limitations on the resolution of the data, especially for very low rates.