Let's with an introduction to Prometheus.
Prometheus is an Open source monitoring solution.
It started at SoundCloud around 2012-2013,
and was made public in early 2015.
Prometheus provides Metrics and Alerting.
It is inspired by Google's Borgmon,
which uses time-series data as a datasource
to then send alerts based on this data.
It fits very well in the cloud native infrastructure.
Prometheus is therefore also a member
of the Cloud Native Foundation,
just like Kubernetes and other
cloud native technologies.
In Prometheus we talk about Dimensional Data:
times series are identified by metric name
and a set of key/value pairs, also called labels.
So here we have a metric name, for instance temperature,
key/value pairs which are labels, for instance,
location equals outside, and then the sample,
which is the actual data for this metric.
Prometheus includes a flexible query language.
Visualizations can be shown using a built-in expression
browser or with integrations like Grafana.
It stores metrics in memory and on local disk
in an own custom, efficient format.
It is written in Go, and many client libraries
and integrations are available,
and this is what makes Prometheus really stand out.
That is, that there are so many libraries
and integrations available.
You can use Prometheus to literally monitor everything.
So how does Prometheus work?
Prometheus collects metrics from monitored targets by
scraping metrics HTTP endpoints.
So that's what you see here on the left.
You have Prometheus and it will scrape the data
using an HTTP endpoint.
So every application or server or database
that you want to monitor needs to expose an HTTP endpoint
that Prometheus then will scrape.
So if you would go to this endpoint, you would just see
the metrics at this point in time.
Prometheus will just scrape this periodically,
and that's how Prometheus can build up its metrics.
This is fundamentally different than other monitoring
and alerting systems,
except this is also how Google's Borgmon works.
Rather than using custom scripts that check on
particular services and systems,
the monitoring data itself is used.
So then, to do the monitoring and alerting around it,
you are going to use the monitoring data itself,
instead of using custom scripts that will monitor and alert
you if something goes wrong.
Scraping endpoints is much more efficient than other
mechanisms, like third-party agents.
So other monitoring solutions use third-party agents
that you install on the servers and they will scrape
data on the server itself.
Scraping is much more efficient than installing an agent
and doing like that.
A single Prometheus server is able to ingest
up to one million samples per second
and several million times series,
and this will only increase in newer versions
when Prometheus becomes more efficient and more performant.