metricsserver

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package metricsserver contains the web server powering metrics

Package metricsserver enables to expose a set of metrics and collectors on a given postgres instance

Index

Constants

View Source
const PrometheusNamespace = "cnpg"

PrometheusNamespace is the namespace to be used for all custom metrics exposed by instances or the operator

Variables

This section is empty.

Functions

func ListenAndServe

func ListenAndServe(tlsConfig *tls.Config) error

ListenAndServe starts the web server handling metrics

func Setup

func Setup(ctx context.Context) error

Setup configure the web statusServer for a certain PostgreSQL instance, and must be invoked before starting the real web statusServer

func Shutdown

func Shutdown() error

Shutdown stops the web metrics server

Types

type Exporter

type Exporter struct {
	Metrics *metrics
	// contains filtered or unexported fields
}

Exporter exports a set of metrics and collectors on a given postgres instance

func NewExporter

func NewExporter(ctx context.Context) *Exporter

NewExporter creates an exporter

func (*Exporter) Collect

func (e *Exporter) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector, collecting the Metrics values to export.

func (*Exporter) ConnectionPool

func (e *Exporter) ConnectionPool() pool.Pooler

ConnectionPool gets or initializes the connection pool for this instance

func (*Exporter) Describe

func (e *Exporter) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector, defining the Metrics we return.

func (*Exporter) GetPgBouncerDB

func (e *Exporter) GetPgBouncerDB() (*sql.DB, error)

GetPgBouncerDB gets a connection to the admin user db "pgbouncer" on this instance

type ShowListsMetrics

type ShowListsMetrics map[string]prometheus.Gauge

ShowListsMetrics contains all the SHOW LISTS Metrics

func NewShowListsMetrics

func NewShowListsMetrics(subsystem string) ShowListsMetrics

NewShowListsMetrics builds the default ShowListsMetrics

func (ShowListsMetrics) Describe

func (s ShowListsMetrics) Describe(ch chan<- *prometheus.Desc)

Describe produces the description for all the contained Metrics

func (ShowListsMetrics) Reset

func (s ShowListsMetrics) Reset()

Reset resets all the contained Metrics

type ShowPoolsMetrics

type ShowPoolsMetrics struct {
	ClActive,
	ClWaiting,
	ClCancelReq,
	ClActiveCancelReq,
	ClWaitingCancelReq,
	SvActive,
	SvActiveCancel,
	SvBeingCanceled,
	SvIdle,
	SvUsed,
	SvTested,
	SvLogin,
	MaxWait,
	MaxWaitUs,
	PoolMode,
	LoadBalanceHosts *prometheus.GaugeVec
}

ShowPoolsMetrics contains all the SHOW POOLS Metrics

func NewShowPoolsMetrics

func NewShowPoolsMetrics(subsystem string) *ShowPoolsMetrics

NewShowPoolsMetrics builds the default ShowPoolsMetrics

func (*ShowPoolsMetrics) Describe

func (r *ShowPoolsMetrics) Describe(ch chan<- *prometheus.Desc)

Describe produces the description for all the contained Metrics

func (*ShowPoolsMetrics) Reset

func (r *ShowPoolsMetrics) Reset()

Reset resets all the contained Metrics

type ShowStatsMetrics

type ShowStatsMetrics struct {
	TotalBindCount,
	TotalClientParseCount,
	TotalServerAssignCount,
	TotalServerParseCount,
	TotalXactCount,
	TotalQueryCount,
	TotalReceived,
	TotalSent,
	TotalXactTime,
	TotalQueryTime,
	TotalWaitTime,
	AvgBindCount,
	AvgClientParseCount,
	AvgServerAssignCount,
	AvgServerParseCount,
	AvgXactCount,
	AvgQueryCount,
	AvgRecv,
	AvgSent,
	AvgXactTime,
	AvgQueryTime,
	AvgWaitTime *prometheus.GaugeVec
}

ShowStatsMetrics contains all the SHOW STATS Metrics

func NewShowStatsMetrics

func NewShowStatsMetrics(subsystem string) *ShowStatsMetrics

NewShowStatsMetrics builds the default ShowStatsMetrics

func (*ShowStatsMetrics) Describe

func (r *ShowStatsMetrics) Describe(ch chan<- *prometheus.Desc)

Describe produces the description for all the contained Metrics

func (*ShowStatsMetrics) Reset

func (r *ShowStatsMetrics) Reset()

Reset resets all the contained Metrics

Jump to

Keyboard shortcuts

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