Grafana and Prometheus have become a popular duo for collecting, querying and graphing metrics, giving teams greater clarity on their operations. Until recently, the databases supported by Grafana have been NoSQL systems, offering SQL-like or custom query languages that were limited in scope (i.e., in comparison to ANSI SQL) and designed for specific data model and architectures in mind. One of these systems is Prometheus. While Prometheus has its own time series storage subsystem specifically for metrics monitoring, sometimes you need something more to allow you to ask more complex questions of your data. With the recent addition of the MySQL and PostgreSQL data sources, full SQL is now available to Grafana users, and more powerful systems are available as persistent backends for storing larger volumes of Prometheus metrics.
Erik Nordström explains how and why to use PostgreSQL as a Prometheus backend to support complex questions (and get a proper SQL interface). Along the way, Erik offers an overview of pg_prometheus, a custom Prometheus datatype, and prometheus-postgresql-adapter, a remote storage adaptor for PostgreSQL, and shares his experience with TimescaleDB, an open source time series database optimized for scalable data ingest and complex query performance, which enables PostgreSQL to scale for classic monitoring volumes.
Erik Nordström is a senior software engineer at Timescale, where he focuses on both core database and infrastructure services. Previously, he worked on Spotify’s backend service infrastructure and was a postdoc and research scientist at Princeton, where he focused on networking and distributed systems, including a new end-host network stack for service-centric networking. Erik holds an MSc and PhD from Uppsala in Sweden.
©2018, O’Reilly UK Ltd • (800) 889-8969 or (707) 827-7019 • Monday-Friday 7:30am-5pm PT • All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners. • email@example.com