Prometheus is an open-source time series database developed by SoundCloud in Go, and serves as the storage layer for the Prometheus monitoring system. Inspired by the Gorilla system at Facebook, Prometheus is specially designed for monitoring and metric collection. Prometheus contains a user-defined multi-dimensional data model and a query language on multi-dimensional data called PromQL. Apart from local disk storage, Prometheus also has remote storage integrations via Protocol Buffer.
Prometheus was started in 2012 in SoundCloud as an open-source project for system monitoring, therefore the system requires an efficient and fault-tolerant storage layer for incoming metrics as well as metadata for these metrics. Thus they built the Prometheus time series database as the backend for the whole monitoring platform.
The Prometheus time series database has gone through three major versions. Prometheus v1 is a basic implementation, where all time series data and label metadata are stored in LevelDB. V2 addressed several shortcomings of v1 by storing time series data on a per time series basis and adoption of delta-of-delta compression. V3 made further improvements by implementing a write ahead log to handle crashes and better data block compaction.
Prometheus stores data as time series. A time series is defined by a metric and a set of key-value labels. A data sample is a data point at a given timestamp, including a float64
value and a unix timestamp. Therefore a time series can be formally defined as <metric>{<label_1>=<value1>, <label_2>=<value2>...}
.
Prometheus supports the following metric types:
Prometheus has an efficient data compression format due to the fact that data samples in the same series often change very little. One of the compression algorithms that Prometheus uses is similar to that of Facebook's Gorilla time-series database, called delta-of-delta compression algorithm. Prometheus also has other customized compression algorithms.
With regard to integration with remote storage engines, Prometheus uses a snappy-compressed protocol buffer encoding over HTTP for both read and write protocols.
Prometheus supports periodic checkpoints, which is done every two hours by default. Checkpoints in Prometheus is done by compacting write ahead logs in a given time range. All the checkpoints are stored in the same directory with the name checkpoint.xxx
, where the xxx
suffix is a number monotonically increase with time. Therefore when Prometheus recovers from crash, it can replay the all the checkpoints in the checkpoint directory in the same order as their suffix.
Prometheus supports flexible configuration to choose backend storage service. Prometheus itself maintains a on-disk checkpoint of series data and also supports remote read/write to other storage systems, making Prometheus's integration with other systems much easier. Also, Prometheus supports custom Webhook receivers to send alert notifications, e.g. AWS SNS and IRC bot.
https://github.com/prometheus/prometheus
SoundCloud
2012