{"repo":"karlseguin/metrics.zig","free":true,"listed":false,"github":"https://github.com/karlseguin/metrics.zig","clone":"git clone https://github.com/karlseguin/metrics.zig.git","description":"Prometheus metrics for library and application developers","language":"Zig","stars":82,"topics":["metrics","prometheus","prometheus-client","zig","zig-library","zig-package"],"license":"MIT","category":"analytics","readme_excerpt":"Prometheus Metric Library for Zig This library is designed for both library and application developers. I do hope to streamline setup when comptime allocations are allowed. It supports, counters, gauges and histograms and the labeled-variant of each. Please see the example project. It demonstrates how a library developer , and how an application developer can initialize and output them. Zig Version This is for Zig 0.16.0. Use the zig-0.15 branch for Zig 0.15.2 or the dev which may or may not be up to date with zig dev. Metric Setup Setup is a bit tedious, and I welcome suggestions for improvement. Let's start with a basic example. While the metrics within this library can be used directly, I believe that each library/application should create its own Metrics struct that encapsulates all metrics. A global instance of this struct can be created and initialized at comptime into a \"noop\" state. The call to m.initializeNoop(Metrics) creates a Metrics and initializes each metric ( hits , connected and latency ) to a \"noop\" implementation (tagged unions are used). The initializeMetrics is called on application startup and sets these metrics to real implementation. For library developers, this means their global metrics are always safe to use (all methods call noop). For application developers, it gives them control over which metrics to enable. All metrics take a name and two options . Why two options? The first is designed for library developers, the second is designed to give appl","default_branch":null,"files":null,"tree":[],"storefront":"/r/karlseguin","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/karlseguin/metrics.zig/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."}