{"repo":"vrischmann/zig-prometheus","free":true,"listed":false,"github":"https://github.com/vrischmann/zig-prometheus","clone":"git clone https://github.com/vrischmann/zig-prometheus.git","description":"Prometheus/VictoriaMetrics client library for Zig","language":"Zig","stars":56,"topics":["zig","prometheus","victoriametrics","zig-package"],"license":"MIT","category":"analytics","readme_excerpt":"zig-prometheus This is a Zig library to add Prometheus-inspired metrics to a library or application. \"Inspired\" because it is not strictly compatible with Prometheus, the Histogram type is tailored for VictoriaMetrics. See this blog post from the creator of VictoriaMetrics for details. Requirements Zig master is the only required dependency. Introduction This library only provides the following types: A Registry holding a number of metrics A Counter metric type A Gauge metric type A Histogram metric type Examples If you want a quick overview of how to use this library check the basic example program. It showcases everything. Reference Registry The Registry is the entry point to obtain a metric type, as well as the type capable of serializing the metrics to a writer. In an application it might be useful to have a default, global registry; in a library you probably should take one as a parameter. Creation Here is how to get a registry: You can also configure some options for the registry: If you want to store the registry in a variable you probably want to do something like this: Now you can get metric objects which we will describe later. Serializing the metrics Once you have a registry you can serialize its metrics to a writer: The write method is thread safe. Counter The Counter type is an atomic integer counter. Here is an example of how to use a counter: All methods on a Counter are thread safe. Gauge The Gauge type represents a numerical value that is provided by calling ","default_branch":null,"files":null,"tree":[],"storefront":"/r/vrischmann","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/vrischmann/zig-prometheus/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}