The following block shows my first code version. My initial code was simple, as I only wanted to make sure Prometheus would be able to scrape it the way I expected. I created a simple version only exposing nun_db_oplog_pending_ops. To make sure I understood all the concepts after reading a bit about exporters and having accessed some of their codes, I decided to code a minimal POC. This exporter will probably grow as the Nun-db’s available metrics grow, yet I want to keep it simple as much as I can, so I won’t be creating too many abstractions at the moment. So I choose to use the Unofficial lib from tikv in GitHub. It looks like most exporters are written in Go, but I wanted to use Rust since Nun-db is written in rust. This was an interesting decision, but it means our exporter has to expose some URLs so Prometheus can capture the metrics. There is excellent documentation on how to write exporters in WRITING EXPORTERS, yet I did not find how they work in a high-level way, so here I am drawing what I understood of the process, the first important thing is that you don’t push metrics to Prometheus, it scrapes the exporters to pick the metrics like I show in the next diagram. In my own words, an exporter is a program that runs closer to the component you want to observe, and it needs to be accessible from the Prometheus so it can scrape the metrics from it. If you don’t know, Nun-db is an open-source real-time database made to be fast, light, and easy to use. Observability is a must-have for infrastructure components like Nun-db, and I want to make sure we will monitor what we need to make it successful. So it seemed the obvious choice when I started to look for an alternative to improving Nun-db observability. I have used Prometheus for a long time, but I never took the time to understand how the exporters work in deep. In this post, I will show my thought process to get the Nun-db Prometheus exporter from idea to POC to repository to the final Grafana chart.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |