larzmetrics
Metrics + Prometheus export.
Counters, gauges and histograms with a Prometheus text exposition export — application metrics without a client library.
larzscript pkg install metrics
What you get
- Counters/gauges/histograms
- Prometheus text export
- Simple API
- Zero dependencies
Try it
import "metrics" as metrics
let m = metrics.new()
metrics.counter_inc(m, "requests_total", {"method": "GET"})
metrics.counter_inc(m, "requests_total", {"method": "GET"})
metrics.gauge_set(m, "queue_depth", 5)
metrics.histogram_observe(m, "latency_seconds", 0.23, {}, [0.1, 0.5, 1])
print(metrics.export_prometheus(m))Output
requests_total{method="GET"} 2
queue_depth 5
latency_seconds_bucket{le="0.1"} 0
latency_seconds_bucket{le="0.5"} 1
latency_seconds_bucket{le="1"} 1
latency_seconds_sum 0.23
latency_seconds_count 1Why it's in the Larz Stack
larzmetrics is a real Larzscript package (larzscript pkg install metrics) - money-native, zero dependencies, the same language as the rest of the estate, not a separate Python runtime. It composes with the rest of the Larz Stack and the Larz framework.