Documentation
¶
Overview ¶
Package metrics owns the Prometheus registry shared across Gantry subsystems and provides constructor helpers that record metric ownership so final audit can verify the metric set is complete.
Subsystems do NOT call prometheus.MustRegister directly; they go through (*Registry).NewCounter / NewGauge / NewHistogram so the ownership map is populated automatically.
Index ¶
- type NameOwner
- type Registry
- func (r *Registry) Handler() http.Handler
- func (r *Registry) NewCounter(subsystem string, opts prometheus.CounterOpts) prometheus.Counter
- func (r *Registry) NewCounterVec(subsystem string, opts prometheus.CounterOpts, labels []string) *prometheus.CounterVec
- func (r *Registry) NewGauge(subsystem string, opts prometheus.GaugeOpts) prometheus.Gauge
- func (r *Registry) NewGaugeFunc(subsystem string, opts prometheus.GaugeOpts, f func() float64) prometheus.GaugeFunc
- func (r *Registry) NewGaugeVec(subsystem string, opts prometheus.GaugeOpts, labels []string) *prometheus.GaugeVec
- func (r *Registry) NewHistogram(subsystem string, opts prometheus.HistogramOpts) prometheus.Histogram
- func (r *Registry) NewHistogramVec(subsystem string, opts prometheus.HistogramOpts, labels []string) *prometheus.HistogramVec
- func (r *Registry) Owners() []NameOwner
- func (r *Registry) PrometheusRegistry() *prometheus.Registry
- func (r *Registry) RegisterDefaultCollectors()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry wraps a *prometheus.Registry with an ownership map of metric name -> subsystem.
func New ¶
func New() *Registry
New returns a Registry with an empty Prometheus registry. New does not install any default Go/process collectors so tests don't see runtime metric noise; cmd/gantry wires those collectors explicitly via reg.RegisterDefaultCollectors.
func (*Registry) NewCounter ¶
func (r *Registry) NewCounter(subsystem string, opts prometheus.CounterOpts) prometheus.Counter
NewCounter registers a Counter and records its ownership.
func (*Registry) NewCounterVec ¶
func (r *Registry) NewCounterVec(subsystem string, opts prometheus.CounterOpts, labels []string) *prometheus.CounterVec
NewCounterVec registers a CounterVec and records its ownership.
func (*Registry) NewGauge ¶
func (r *Registry) NewGauge(subsystem string, opts prometheus.GaugeOpts) prometheus.Gauge
NewGauge registers a Gauge and records its ownership.
func (*Registry) NewGaugeFunc ¶
func (r *Registry) NewGaugeFunc(subsystem string, opts prometheus.GaugeOpts, f func() float64) prometheus.GaugeFunc
NewGaugeFunc registers a GaugeFunc and records its ownership.
func (*Registry) NewGaugeVec ¶
func (r *Registry) NewGaugeVec(subsystem string, opts prometheus.GaugeOpts, labels []string) *prometheus.GaugeVec
NewGaugeVec registers a GaugeVec and records its ownership.
func (*Registry) NewHistogram ¶
func (r *Registry) NewHistogram(subsystem string, opts prometheus.HistogramOpts) prometheus.Histogram
NewHistogram registers a Histogram and records its ownership.
func (*Registry) NewHistogramVec ¶
func (r *Registry) NewHistogramVec(subsystem string, opts prometheus.HistogramOpts, labels []string) *prometheus.HistogramVec
NewHistogramVec registers a HistogramVec and records its ownership.
func (*Registry) Owners ¶
Owners returns the metric-name -> subsystem map, sorted by name. Used by audit step to compare against the inventory.
func (*Registry) PrometheusRegistry ¶
func (r *Registry) PrometheusRegistry() *prometheus.Registry
PrometheusRegistry exposes the underlying *prometheus.Registry for tests or for code that must register a third-party collector directly.
func (*Registry) RegisterDefaultCollectors ¶
func (r *Registry) RegisterDefaultCollectors()
RegisterDefaultCollectors adds the standard process and Go runtime collectors. Call from cmd/gantry, not from tests.