Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoData = errors.New("collector returned no data")
ErrNoData indicates the collector found no data to collect, but had no other error.
Functions ¶
func IsNoDataError ¶
Types ¶
type Collector ¶
type Collector interface {
Update(ctx context.Context, db *sql.DB, ch chan<- prometheus.Metric) error
}
func NewPGDatabaseCollector ¶
func NewPGReplicationSlotCollector ¶ added in v0.12.0
type Option ¶
type Option func(*PostgresCollector) error
type PGDatabaseCollector ¶
type PGDatabaseCollector struct {
// contains filtered or unexported fields
}
func (PGDatabaseCollector) Update ¶
func (c PGDatabaseCollector) Update(ctx context.Context, db *sql.DB, ch chan<- prometheus.Metric) error
Update implements Collector and exposes database size. It is called by the Prometheus registry when collecting metrics. The list of databases is retrieved from pg_database and filtered by the excludeDatabase config parameter. The tradeoff here is that we have to query the list of databases and then query the size of each database individually. This is because we can't filter the list of databases in the query because the list of excluded databases is dynamic.
type PGReplicationSlotCollector ¶ added in v0.12.0
type PGReplicationSlotCollector struct {
// contains filtered or unexported fields
}
func (PGReplicationSlotCollector) Update ¶ added in v0.12.0
func (PGReplicationSlotCollector) Update(ctx context.Context, db *sql.DB, ch chan<- prometheus.Metric) error
type PGStatBGWriterCollector ¶
type PGStatBGWriterCollector struct { }
func (PGStatBGWriterCollector) Update ¶
func (PGStatBGWriterCollector) Update(ctx context.Context, db *sql.DB, ch chan<- prometheus.Metric) error
type PostgresCollector ¶
type PostgresCollector struct { Collectors map[string]Collector // contains filtered or unexported fields }
PostgresCollector implements the prometheus.Collector interface.
func NewPostgresCollector ¶
func NewPostgresCollector(logger log.Logger, excludeDatabases []string, dsn string, filters []string, options ...Option) (*PostgresCollector, error)
NewPostgresCollector creates a new PostgresCollector.
func (PostgresCollector) Collect ¶
func (p PostgresCollector) Collect(ch chan<- prometheus.Metric)
Collect implements the prometheus.Collector interface.
func (PostgresCollector) Describe ¶
func (p PostgresCollector) Describe(ch chan<- *prometheus.Desc)
Describe implements the prometheus.Collector interface.
type ProbeCollector ¶ added in v0.12.0
type ProbeCollector struct {
// contains filtered or unexported fields
}
func NewProbeCollector ¶ added in v0.12.0
func NewProbeCollector(logger log.Logger, excludeDatabases []string, registry *prometheus.Registry, dsn config.DSN) (*ProbeCollector, error)
func (*ProbeCollector) Close ¶ added in v0.12.0
func (pc *ProbeCollector) Close() error
func (*ProbeCollector) Collect ¶ added in v0.12.0
func (pc *ProbeCollector) Collect(ch chan<- prometheus.Metric)
func (*ProbeCollector) Describe ¶ added in v0.12.0
func (pc *ProbeCollector) Describe(ch chan<- *prometheus.Desc)