Documentation ¶
Overview ¶
Copyright 2023 The Prometheus Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2023 The Prometheus Authors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func IsNoDataError(err error) bool
- type Collector
- func NewPGDatabaseCollector(config collectorConfig) (Collector, error)
- func NewPGDatabaseWraparoundCollector(config collectorConfig) (Collector, error)
- func NewPGLocksCollector(config collectorConfig) (Collector, error)
- func NewPGLongRunningTransactionsCollector(config collectorConfig) (Collector, error)
- func NewPGPostmasterCollector(collectorConfig) (Collector, error)
- func NewPGProcessIdleCollector(config collectorConfig) (Collector, error)
- func NewPGReplicationCollector(collectorConfig) (Collector, error)
- func NewPGReplicationSlotCollector(config collectorConfig) (Collector, error)
- func NewPGRolesCollector(config collectorConfig) (Collector, error)
- func NewPGStatActivityAutovacuumCollector(config collectorConfig) (Collector, error)
- func NewPGStatBGWriterCollector(collectorConfig) (Collector, error)
- func NewPGStatDatabaseCollector(config collectorConfig) (Collector, error)
- func NewPGStatIOUserTablesCollector(config collectorConfig) (Collector, error)
- func NewPGStatStatementsCollector(config collectorConfig) (Collector, error)
- func NewPGStatUserTablesCollector(config collectorConfig) (Collector, error)
- func NewPGStatWalReceiverCollector(config collectorConfig) (Collector, error)
- func NewPGStatioUserIndexesCollector(config collectorConfig) (Collector, error)
- func NewPGWALCollector(config collectorConfig) (Collector, error)
- func NewPGXlogLocationCollector(config collectorConfig) (Collector, error)
- type Option
- type PGDatabaseCollector
- type PGDatabaseWraparoundCollector
- type PGLocksCollector
- type PGLongRunningTransactionsCollector
- type PGPostmasterCollector
- type PGProcessIdleCollector
- type PGReplicationCollector
- type PGReplicationSlotCollector
- type PGRolesCollector
- type PGStatActivityAutovacuumCollector
- type PGStatBGWriterCollector
- type PGStatDatabaseCollector
- type PGStatIOUserTablesCollector
- type PGStatStatementsCollector
- type PGStatUserTablesCollector
- type PGStatWalReceiverCollector
- type PGStatioUserIndexesCollector
- type PGWALCollector
- type PGXlogLocationCollector
- type PostgresCollector
- type ProbeCollector
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, instance *instance, ch chan<- prometheus.Metric) error
}
func NewPGDatabaseCollector ¶
func NewPGDatabaseWraparoundCollector ¶ added in v0.14.0
func NewPGLocksCollector ¶ added in v0.14.0
func NewPGLongRunningTransactionsCollector ¶ added in v0.14.0
func NewPGPostmasterCollector ¶ added in v0.13.0
func NewPGProcessIdleCollector ¶ added in v0.13.0
func NewPGReplicationCollector ¶ added in v0.13.0
func NewPGReplicationSlotCollector ¶ added in v0.12.0
func NewPGRolesCollector ¶ added in v0.16.0
func NewPGStatActivityAutovacuumCollector ¶ added in v0.14.0
func NewPGStatDatabaseCollector ¶ added in v0.13.0
func NewPGStatIOUserTablesCollector ¶ added in v0.13.0
func NewPGStatStatementsCollector ¶ added in v0.13.0
func NewPGStatUserTablesCollector ¶ added in v0.13.0
func NewPGStatWalReceiverCollector ¶ added in v0.14.0
func NewPGStatioUserIndexesCollector ¶ added in v0.14.0
func NewPGWALCollector ¶ added in v0.14.0
func NewPGXlogLocationCollector ¶ added in v0.14.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, instance *instance, ch chan<- prometheus.Metric) error
Update implements Collector and exposes database size and connection limits. 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 PGDatabaseWraparoundCollector ¶ added in v0.14.0
type PGDatabaseWraparoundCollector struct {
// contains filtered or unexported fields
}
func (*PGDatabaseWraparoundCollector) Update ¶ added in v0.14.0
func (c *PGDatabaseWraparoundCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error
type PGLocksCollector ¶ added in v0.14.0
type PGLocksCollector struct {
// contains filtered or unexported fields
}
func (PGLocksCollector) Update ¶ added in v0.14.0
func (c PGLocksCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error
Update implements Collector and exposes database locks. It is called by the Prometheus registry when collecting metrics.
type PGLongRunningTransactionsCollector ¶ added in v0.14.0
type PGLongRunningTransactionsCollector struct {
// contains filtered or unexported fields
}
func (PGLongRunningTransactionsCollector) Update ¶ added in v0.14.0
func (PGLongRunningTransactionsCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error
type PGPostmasterCollector ¶ added in v0.13.0
type PGPostmasterCollector struct { }
func (*PGPostmasterCollector) Update ¶ added in v0.13.0
func (c *PGPostmasterCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error
type PGProcessIdleCollector ¶ added in v0.13.0
type PGProcessIdleCollector struct {
// contains filtered or unexported fields
}
func (PGProcessIdleCollector) Update ¶ added in v0.13.0
func (PGProcessIdleCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error
type PGReplicationCollector ¶ added in v0.13.0
type PGReplicationCollector struct { }
func (*PGReplicationCollector) Update ¶ added in v0.13.0
func (c *PGReplicationCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error
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, instance *instance, ch chan<- prometheus.Metric) error
type PGRolesCollector ¶ added in v0.16.0
type PGRolesCollector struct {
// contains filtered or unexported fields
}
func (PGRolesCollector) Update ¶ added in v0.16.0
func (c PGRolesCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error
Update implements Collector and exposes roles connection limits. It is called by the Prometheus registry when collecting metrics.
type PGStatActivityAutovacuumCollector ¶ added in v0.14.0
type PGStatActivityAutovacuumCollector struct {
// contains filtered or unexported fields
}
func (PGStatActivityAutovacuumCollector) Update ¶ added in v0.14.0
func (PGStatActivityAutovacuumCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error
type PGStatBGWriterCollector ¶
type PGStatBGWriterCollector struct { }
func (PGStatBGWriterCollector) Update ¶
func (PGStatBGWriterCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error
type PGStatDatabaseCollector ¶ added in v0.13.0
type PGStatDatabaseCollector struct {
// contains filtered or unexported fields
}
func (*PGStatDatabaseCollector) Update ¶ added in v0.13.0
func (c *PGStatDatabaseCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error
type PGStatIOUserTablesCollector ¶ added in v0.13.0
type PGStatIOUserTablesCollector struct {
// contains filtered or unexported fields
}
func (PGStatIOUserTablesCollector) Update ¶ added in v0.13.0
func (PGStatIOUserTablesCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error
type PGStatStatementsCollector ¶ added in v0.13.0
type PGStatStatementsCollector struct {
// contains filtered or unexported fields
}
func (PGStatStatementsCollector) Update ¶ added in v0.13.0
func (PGStatStatementsCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error
type PGStatUserTablesCollector ¶ added in v0.13.0
type PGStatUserTablesCollector struct {
// contains filtered or unexported fields
}
func (*PGStatUserTablesCollector) Update ¶ added in v0.13.0
func (c *PGStatUserTablesCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error
type PGStatWalReceiverCollector ¶ added in v0.14.0
type PGStatWalReceiverCollector struct {
// contains filtered or unexported fields
}
func (*PGStatWalReceiverCollector) Update ¶ added in v0.14.0
func (c *PGStatWalReceiverCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error
type PGStatioUserIndexesCollector ¶ added in v0.14.0
type PGStatioUserIndexesCollector struct {
// contains filtered or unexported fields
}
func (*PGStatioUserIndexesCollector) Update ¶ added in v0.14.0
func (c *PGStatioUserIndexesCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error
type PGWALCollector ¶ added in v0.14.0
type PGWALCollector struct { }
func (PGWALCollector) Update ¶ added in v0.14.0
func (c PGWALCollector) Update(ctx context.Context, instance *instance, ch chan<- prometheus.Metric) error
type PGXlogLocationCollector ¶ added in v0.14.0
type PGXlogLocationCollector struct {
// contains filtered or unexported fields
}
func (PGXlogLocationCollector) Update ¶ added in v0.14.0
func (c PGXlogLocationCollector) Update(ctx context.Context, instance *instance, 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 *slog.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 *slog.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)
Source Files ¶
- collector.go
- instance.go
- pg_database.go
- pg_database_wraparound.go
- pg_locks.go
- pg_long_running_transactions.go
- pg_postmaster.go
- pg_process_idle.go
- pg_replication.go
- pg_replication_slot.go
- pg_roles.go
- pg_stat_activity_autovacuum.go
- pg_stat_bgwriter.go
- pg_stat_database.go
- pg_stat_statements.go
- pg_stat_user_tables.go
- pg_stat_walreceiver.go
- pg_statio_user_indexes.go
- pg_statio_user_tables.go
- pg_wal.go
- pg_xlog_location.go
- probe.go