Prometheus.jl release announcement

I want to announce Prometheus.jl - a Prometheus client for Julia.



Metrics from eu-central package servers collected with Prometheus.jl, scraped by Prometheus and visualized with Grafana.


Prometheus is an open-source monitoring system used to track the performance of systems and services. Prometheus is a pull-based monitoring system which means that it requests metrics from the service. (Conversely, in push-based systems the service itself pushes metrics.) In particular this means that there has to be a client that can respond to the requests – this is what Prometheus.jl provides.

Prometheus documentation give detailed guidelines for writing clients, so if you have used any of the existing clients the Julia client should be familiar. All clients are built around the concept of metrics, collectors and collector registries. A registry is basically a collection of collectors, and each collector provides one or more metrics. When responding to a metrics request the client exposes all metrics provided by all collectors in a given registry. The upstream Prometheus documentation describes this in more detail.


As of version 1.3.0 Prometheus.jl implements everything that the guideline expects from a client – and more! Some highlights:

  • All four basic collectors (Counter, Gauge, Summary, and Histogram) are available.
  • A Family collector for metric/collector labeling.
  • A ProcessCollector that provides metrics about a process (the Julia process by default) from the /proc filesystem.
  • A GCCollector that provides allocation and GC metrics.
  • Collector registries with associated functionality such as the ability to register and deregister collectors.
  • A default collector registry where new collectors are registered by default (unless another registry is specified).
  • Thread safety for modifying and accessing collectors.
  • Metric exposition with gzip compression integrated with HTTP.jl (or any other IO stream).
  • A Prometheus.@time macro to measure the walltime of a code block and record it in an associated collector.
  • A Prometheus.@inprogress macro that automatically increments/decrements a Gauge whenever entering/exiting a code block.

Please read the documentation for more information and details.


I originally authored this package to help with package server maintenance and it has been used “in production” since late 2023, see PkgServer.jl#196 (this PR can also serve as an example for how to integrate Prometheus.jl into an existing code base). For the package servers the metrics are (currently) publicly visible so you can check them out if you visit https://pkg.julialang.org/metrics.

Of course, the raw metrics are not very interesting to look at. How to configure Prometheus to scrape the metrics is very well documented in the Prometheus docs, and how to configure Grafana to use Prometheus as a data source is very well documented in the Grafana docs. Once you configure this you can look at pretty graphs like the one in the beginning of the post!


If you have any feedback, please open an issue on the repository or post here.

Happy monitoring!

46 Likes

This is awesome; thanks @fredrikekre! I’ve wanted a solid prometheus implementation for a while!

2 Likes

This is amazing! Thank you!

1 Like