Integrated: metrics: add library
Erik Helin
ehelin at openjdk.java.net
Wed May 12 07:03:30 UTC 2021
On Tue, 11 May 2021 18:32:17 GMT, Erik Helin <ehelin at openjdk.org> wrote:
> Hi all,
>
> please review this patch that adds the new `metrics` library. The metrics library can be used to collect runtime metrics, such as the number of HTTP requests or the number of bot runs. The library is designed according to the [Prometheus library guide](https://prometheus.io/docs/instrumenting/writing_clientlibs/) and currently features the two Prometheus types [gauge](https://prometheus.io/docs/concepts/metric_types/#gauge) and [counter](https://prometheus.io/docs/concepts/metric_types/#counter). The library is designed to allow it to be extended with the [histogram](https://prometheus.io/docs/concepts/metric_types/#histogram) and [summary](https://prometheus.io/docs/concepts/metric_types/#summary) types if we find a need for them.
>
> The `Counter` and `Gauge` types are designed to be thread-safe and should typically be stored in a `private final static` variable in a classes (similar to how one might store a `Logger` instance). A minimal `Counter` example looks like:
>
>
> class Example {
> private static final Counter counter = Counter.name("test").register();
> }
>
>
> I won't go into details here on how Prometheus naming and labelling works, please see the Prometheus [documentation](https://prometheus.io/docs/introduction/overview/) for those concepts. The goal is that library should be fairly self-explanatory for someone with an understanding of how Prometheus works. Note though that the `metrics` library itself is not tied to Prometheus in any way, it only supports the collection of runtime metrics. It is however designed to make it easy to write a Prometheus exporter, something I will show in a follow-up patch.
>
> I also added a bunch of unit tests for the new library.
>
> Thanks,
> Erik
This pull request has now been integrated.
Changeset: 537acafc
Author: Erik Helin <ehelin at openjdk.org>
URL: https://git.openjdk.java.net/skara/commit/537acafcd3cfd453b909edea154fe283d8d5e628
Stats: 1234 lines in 34 files changed: 1228 ins; 1 del; 5 mod
metrics: add library
Reviewed-by: erikj
-------------
PR: https://git.openjdk.java.net/skara/pull/1148
More information about the skara-dev
mailing list