metrics
Generated by tinox doc
tinox.core.metrics, split out of the bundled stdlib as a standalone tinox-central package.
Counters and stopwatch
import tinox.core.metrics
class Main
{
fnc main() -> Int32
{
let m: MetricsRegistry = MetricsRegistry { }
m.incCounter("requests_total")
m.setGauge("queue_depth", 3)
let sw: MetricsStopwatch = MetricsStopwatch::start()
// ... do some work ...
MetricsStopwatch::recordTo(sw, "work_duration_ns")
println(m.prometheusFormat())
return 0
}
}
class MetricsRegistry
Methods
fn incCounter(name: String) → Nothing
fn recordDuration(name: String, durationNs: Int64) → Nothing
fn setGauge(name: String, value: Int64) → Nothing
fn prometheusFormat() → String
class MetricsStopwatch
Fields
startNs | Int64 |
Methods
fn start() → MetricsStopwatch
fn elapsedNs(sw: MetricsStopwatch) → Int64
fn recordTo(sw: MetricsStopwatch, metricName: String) → Nothing