Prometheus

Estimated reading time: 2 min

Introduction

I use Prometheus when I want to keep track of my application stats. You can find it on https://prometheus.io/. It implements highly dimensional data model and provides PromQL query language for slicing and dicing of collected time series data. It has efficient storage in memory and on disk with retention policies so you do not overflow your drive with data.

It is widely used with Grafana as a frontend.

It has a support for wide variety of programming languages like JavaScript, Python, Node, .Net (including Core), Java etc.

Here you can see the dashboard:

dashboard

Usually I collect some stats on a machine (virtual or docker container) where at the end I can see what stats are collected there:

exceptions

DB

It is widely used with InfluxDB as a data aggregator, although you can also use it without dedicated DB (it is able to store flow of data on disk, do not forget to put retention policies in place though). When you have ELK stack (ElasticSearch + Logstash) available, you can use ElasticSearch as storage aggregator too - altough when you do not need some advanced search, or forecasting capabilities, just stick to Prometheus + InfluxDB for simplicity and HW costs.

Alerting

The same query you built for displaying data can be used for trigerring an alert.