Prometheus exporter for go-perfstat.
The collector exposes all registered go-perfstat statistics as Prometheus
metrics with type and name labels.
prometheus.MustRegister(perfstat.NewPerfStatMetricsCollector())With custom constant labels:
prometheus.MustRegister(
perfstat.NewPerfStatMetricsCollectorWithLabels(prometheus.Labels{
"application": "my-service",
}),
)Default aggregation period is 15s.
http.Handle("/metrics", promhttp.Handler())
log.Fatal(http.ListenAndServe(":9090", nil))The collector exports global and aggregation-period statistics:
perfstat_minTimeMs
perfstat_minTimeSampleMs
perfstat_avgTimeMs
perfstat_avgTimeSampleMs
perfstat_maxTimeMs
perfstat_maxTimeSampleMs
perfstat_totalTimeSec
perfstat_leapsCount
perfstat_leapsCountSample
perfstat_peersCount
Each metric has the following labels:
type
name
A ready-to-import Grafana dashboard is available here:
https://github.com/go-perfstat/prometheus/blob/main/dashboard/PerfStat.json