Introducing Prometheus API v0.2.0

Semi-annual project report by the author

Hayk Davtyan
Level Up Coding

--

Since its initial release, the prometheus-api project has introduced several features.
This project enhances the native Prometheus HTTP API by adding new functionalities and addressing existing limitations. By running as a sidecar alongside the Prometheus server, it enables users to significantly extend the API’s capabilities. For more insights and a getting-started guide, you can check out the first blog post about the prometheus-api here.

Discover what’s new in Prometheus API: key updates from v0.1.0 to v0.2.0

Over the past several months, we have introduced key changes and features, some of which were part of our initial roadmap:

  1. Web UI for easy management of Prometheus rules: Users can now manage Prometheus rules directly through a user-friendly interface. - Q2 2024
  2. Support for exposing Prometheus metrics: This feature allows integration with Grafana dashboards, making it easier to visualize metrics. - Q1 2024
  3. Support for modifying rule files via “PUT /api/v1/rules”: Users can override, recreate, or update rule files directly through the API. - Q1 2024
  4. Comprehensive API documentation powered by Redocly: We have provided detailed and accessible documentation to help users navigate and utilize our API effectively. - Q1 2024

Let’s delve into each of these points to understand their significance and necessity.

Web UI for management of Prometheus rules

This essential feature, introduced in version 0.2.0, allows for the management of Prometheus alerting and recording rules through a user-friendly interface. Although it is a significant enhancement, it is currently disabled by default. The primary goal of this project is to enhance the native APIs of Prometheus by acting as a proxy application. To enable the web UI, users must pass the --web.enable-ui=true flag at the application’s startup.

Img. 1 Homepage of prometheus-api

From the UI’s homepage, users can easily switch between the Prometheus native UI and the Rules Management pages. This allows them to run queries and manage their rules effectively.

Img. 2 Rules Management page

Rules management encompasses key functionalities such as creating, updating, deleting, and searching both alerting and recording rules

Support for exposing Prometheus metrics

The prometheus-api exposes metrics under the /api-metrics path. This ensures that the /metrics path of the Prometheus server remains accessible for exposing its own metrics. Additionally, users can utilize the built-in Grafana dashboard to monitor the performance and gain insights into their prometheus-api application. This feature was introduced in version 0.1.5

Img. 3 Grafana dashboard - Prometheus API Overview

Support for modifying rule files via API

This feature was introduced in version 0.1.4 and has been integrated with the PUT /api/v1/rules API, aligning with one of our initial roadmap goals since the project's inception. For details on how to use this feature, please refer to the respective documentation.

API documentation powered by Redocly

It’s a fact that clear and well-written documentation is crucial for any software, especially those providing an API. Recognizing the importance of this aspect, we introduced auto-generating documentation based on the OpenAPI specification in the 0.1.3 release.

Img. 4 API documentation powered by ReDoc

Conclusion

In conclusion, the recent enhancements to the prometheus-api are specifically designed to facilitate the management of the Prometheus server for software and observability engineers in any environment, be it development or production.

Thanks for reading. I hope this story was helpful. If you are interested, check out my other Medium articles.

--

--

DevOps Engineer at @Picsart | Observability enthusiast | #Linux #Python #Docker #Kubernetes #Helm #AWS #GCP #Prometheus #Grafana #ELK #Git