Documentation
¶
Overview ¶
Package prommetrics provides Prometheus metrics for the application; the name avoids conflicting with standard library or common "metrics" package names.
Index ¶
Constants ¶
const ( NAMESPACE = "gst" SUBSYSTEM = "backend" )
NAMESPACE and SUBSYSTEM prefix every metric of the framework; Prometheus joins them and the name with underscores, so a metric of the backend is named gst_backend_<name> and one of the process gst_process_<name>.
Variables ¶
var ( State prometheus.Gauge Uptime prometheus.Gauge HTTPRequestsTotal *prometheus.CounterVec HTTPRequestDuration *prometheus.HistogramVec ResponseTime prometheus.Histogram ErrorRate prometheus.Counter MemoryTotal prometheus.Gauge MemoryUsed prometheus.Gauge MemoryUsedPercent prometheus.Gauge CPUCount prometheus.Gauge CPUUsedPercent prometheus.Gauge ConcurrentConnections prometheus.Gauge CacheHit *prometheus.CounterVec CacheMiss *prometheus.CounterVec QueueSize prometheus.Gauge AuthzPolicyDiverged prometheus.Gauge AuthzDecisionsTotal *prometheus.CounterVec AuditWriteFailuresTotal prometheus.Counter )
Functions ¶
func RegisterDBStats ¶
RegisterDBStats exposes one database handle's connection pool to the default Prometheus registry under dbName (the collector's db_name label). The standard collector reads sql.DB.Stats at scrape time, so registration adds no background work.
Registering a name again replaces that name's previous collector, which keeps re-initialization idempotent: a test harness that reopens the database re-registers instead of failing, and the collector never outlives the handle it reads. It does not require Init to have run — collectors on the default registry simply stay unserved until a metrics endpoint is up.
Types ¶
This section is empty.