The YugaByte Database Blog

Thoughts on open source, cloud native and distributed databases

How to Monitor YugaByte DB with Prometheus on Docker?

Observability is absolutely vital to operating business-critical data infrastructure at scale. This is why observability is not an afterthought in the YugaByte DB architecture. Every layer of YugaByte DB exposes metrics in the Prometheus format at the /prometheus-metrics endpoint. Given that Prometheus is essentially the de-facto standard for build-your-own infrastructure monitoring and alerting, you can get started with monitoring YugaByte DB in almost no time.

This post details how to install and configure both YugaByte DB and Prometheus on Docker so that you can run simple queries on the Prometheus UI. A follow-up post will go through each layer of YugaByte DB (including API implementation, query layer, core DB server, DocDB document store as well as underlying node CPU/disk resources) and highlight the top metrics that matter for ensuring high performance.

Install YugaByte DB

Create a YugaByte DB Cluster

Run Sample Key-Value Workload

Run a simple key-value workload in a separate shell.

Prepare Prometheus Config File

Copy the following into a file called yugabytedb.yml. Move this file to the /tmp directory so that we can bind the file to the Prometheus container later on.

Start Prometheus Server

Start the Prometheus server as below. The prom/prometheus container image will be pulled from the Docker registry if not already present on the localhost.

Open the Prometheus UI at http://localhost:9090 and then navigate to the Targets page under Status.

Analyze Key Metrics

On the Prometheus Graph UI, you can now plot the read/write throughput and latency for the CassandraKeyValue sample app. As we can see from the source code of the app, it uses only SELECT statements for reads and INSERT statements for writes (aside from the initial CREATE TABLE). This means we can measure throughput and latency by simply using the metrics corresponding to the ELECT and INSERT statements.

Paste the following expressions into the Expression box and click Execute followed by Add Graph.

Throughput

Read IOPS

Write IOPS

Latency

Read Latency (in microseconds)

Write Latency (in microseconds)

Delete Cluster (Optional)

Optionally, you can shutdown the local cluster created in Step 1.

Summary

Getting started with YugaByte DB and Prometheus on Docker is extremely simple as highlighted in this post. If you are interested in doing the same on macOS or Linux, then instructions are available in documentation. We look forward to the next post in this series where we will look into the top metrics that matter for each layer of YugaByte DB.

What’s Next?