Something went wrong. Try again.
Prometheus metrics for library and application developers forked from karlseguin.tngl.sh/metrics.zig
Something went wrong. Try again.
648 B · 21 lines
Zig
at master
12345678910111213141516171819202122// This folder simulates a 3rd party library that the application, main.zig// is using.
const metrics = @import("metrics.zig");
// Expose initializeMetrics to give control to the application over whether or// not the library metrics should be enabled.pub const initializeMetrics = metrics.initialize;
// Expose writeMetrics to the applicationpub const writeMetrics = metrics.write;
// We want to collect metrics about thispub fn doSomething() !void { metrics.active(10);
// vectored metrics can fail, hence the try try metrics.hit(.{ .status = 200, .path = "/robots.txt" });
try metrics.latency(.{ .path = "/" }, 3.2);}