That's what prometheus is doing for example. https://prometheus.io/docs/prometheus/latest/querying/api/