Cortex: Stateful Prometheus Monitoring for Multiple Clients
While many in the cloud native community praise the Prometheus monitoring tool for its ease of use, it was not designed to permanently store operational data, nor be used for more than one client. Now a project from Weaveworks, called Cortex, packages Prometheus to address this issue, offering long-term distributed storage of data, as well as multitenancy for service providers that want to offer Prometheus as a service.
Last week, the Cloud Native Computing Foundation (CNCF) admitted Cortex into the CNCF Sandbox, a home for early stage and evolving cloud native projects.
Weaveworks initially developed Cortex to support its own commercial cloud offering, Weave Cloud. A monitoring and alerting toolkit, Prometheus is used for collecting, displaying and analyzing time-series data collected from IT resources.
Initially, the company deployed multiple copies of Prometheus through Kubernetes ReplicaSets, though this approach had many limitations. “We made no provision for long-term storage. If Prometheus crashed, we’d lose our time-series data. If we upgraded the version of Prometheus, we’d lose our time-series data. If we changed our alerting rules, we’d lose our time-series data,” Weaveworks engineering vice president Jonathan Lange explained in a blog post.
Cortex can be thought of as a way to offer “Prometheus-as-a-Service,” said Sonja Schweigert, Weaveworks vice president of marketing.
Cortex offers a fully compatible API for Prometheus queries (using PromQL) that can be used by multiple clients, or lines of business, for their own workloads. It can scale out horizontally, meaning a single deployment is capable of managing hundreds of thousands of metrics from many systems. This approach beats the management hassle of maintaining a separate copy of Prometheus for each individual client.
Also, unlike Prometheus itself, Cortex provides long-term retention of data, by periodically bundling performance samples and periodically writing them to a distributed storage backend, such as DynamoDB, BigTable, or Cassandra, using an approach inspired by the Amazon Dynamo architecture.
In addition to Weaveworks itself, Grafana Labs, FreshTracks, and EA also use Cortex.
The Cloud Native Computing Foundation is a sponsor of The New Stack.