prometheus

module
v1.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 23, 2026 License: Apache-2.0

README

go-perfstat/prometheus

Prometheus exporter for go-perfstat.

The collector exposes all registered go-perfstat statistics as Prometheus metrics with type and name labels.

Register collector

prometheus.MustRegister(perfstat.NewPerfStatMetricsCollector())

With custom constant labels:

prometheus.MustRegister(
	perfstat.NewPerfStatMetricsCollectorWithLabels(prometheus.Labels{
		"application": "my-service",
	}),
)

Default aggregation period is 15s.

Expose /metrics

http.Handle("/metrics", promhttp.Handler())
log.Fatal(http.ListenAndServe(":9090", nil))

Metrics

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

Grafana dashboard

A ready-to-import Grafana dashboard is available here:

https://github.com/go-perfstat/prometheus/blob/main/dashboard/PerfStat.json

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL