-
Book Overview & Buying
-
Table Of Contents
Practical Systems Programming in Go
By :
Reading data from Prometheus involves interacting with one of the most popular monitoring and time-series databases in modern systems. Prometheus communicates primarily over HTTP: applications expose metrics at a path (usually /metrics) that Prometheus scrapes at regular intervals, and Prometheus provides an HTTP API that allows clients to query its time series database using PromQL (Prometheus Query Language). This API supports retrieving raw metrics, aggregated statistics, and metadata. To explore these capabilities with our Go utility, we first need some sample metrics — let us create them in the next section.
In this subsection, we will create sample metrics and push them to Prometheus so that we have meaningful values to retrieve later using ch09/Prometheus/sampleData.go. The program is designed to simulate realistic Prometheus metrics and optionally push them to a Pushgateway, which is a component of the Prometheus...