Documentation
¶
Index ¶
- Constants
- func NewDBWithPgStatStatements(config *Config) (*store.DB, error)
- type Collector
- func NewCPUCollector(labels prometheus.Labels) (Collector, error)
- func NewDiskstatsCollector(labels prometheus.Labels) (Collector, error)
- func NewFilesystemCollector(labels prometheus.Labels) (Collector, error)
- func NewLoadAverageCollector(labels prometheus.Labels) (Collector, error)
- func NewMeminfoCollector(labels prometheus.Labels) (Collector, error)
- func NewNetdevCollector(labels prometheus.Labels) (Collector, error)
- func NewNetworkCollector(labels prometheus.Labels) (Collector, error)
- func NewPgbouncerPoolsCollector(constLabels prometheus.Labels) (Collector, error)
- func NewPgbouncerSettingsCollector(constLabels prometheus.Labels) (Collector, error)
- func NewPgbouncerStatsCollector(constLabels prometheus.Labels) (Collector, error)
- func NewPgscvServicesCollector(labels prometheus.Labels) (Collector, error)
- func NewPostgresActivityCollector(constLabels prometheus.Labels) (Collector, error)
- func NewPostgresBgwriterCollector(constLabels prometheus.Labels) (Collector, error)
- func NewPostgresConflictsCollector(constLabels prometheus.Labels) (Collector, error)
- func NewPostgresDatabasesCollector(constLabels prometheus.Labels) (Collector, error)
- func NewPostgresFunctionsCollector(constLabels prometheus.Labels) (Collector, error)
- func NewPostgresIndexesCollector(constLabels prometheus.Labels) (Collector, error)
- func NewPostgresLocksCollector(constLabels prometheus.Labels) (Collector, error)
- func NewPostgresLogsCollector(constLabels prometheus.Labels) (Collector, error)
- func NewPostgresReplicationCollector(constLabels prometheus.Labels) (Collector, error)
- func NewPostgresReplicationSlotsCollector(constLabels prometheus.Labels) (Collector, error)
- func NewPostgresSchemasCollector(constLabels prometheus.Labels) (Collector, error)
- func NewPostgresSettingsCollector(constLabels prometheus.Labels) (Collector, error)
- func NewPostgresStatementsCollector(constLabels prometheus.Labels) (Collector, error)
- func NewPostgresStorageCollector(constLabels prometheus.Labels) (Collector, error)
- func NewPostgresTablesCollector(constLabels prometheus.Labels) (Collector, error)
- func NewSysconfigCollector(labels prometheus.Labels) (Collector, error)
- type Config
- type Factories
- type PgscvCollector
- type PostgresServiceConfig
Constants ¶
const ( // Postgres server versions numeric representations. PostgresV95 = 90500 PostgresV96 = 90600 PostgresV10 = 100000 PostgresV12 = 120000 PostgresV13 = 130000 // Minimal required version is 9.5. PostgresVMinNum = PostgresV95 PostgresVMinStr = "9.5" )
Variables ¶
This section is empty.
Functions ¶
func NewDBWithPgStatStatements ¶
NewDBWithPgStatStatements returns connection to the database where pg_stat_statements available for getting stats. Executing this function supposes pg_stat_statements is already available in shared_preload_libraries (checked when setting up service).
Types ¶
type Collector ¶
type Collector interface {
// Get new metrics and expose them via prometheus registry.
Update(config Config, ch chan<- prometheus.Metric) error
}
Collector is the interface a collector has to implement.
func NewCPUCollector ¶
func NewCPUCollector(labels prometheus.Labels) (Collector, error)
NewCPUCollector returns a new Collector exposing kernel/system statistics.
func NewDiskstatsCollector ¶
func NewDiskstatsCollector(labels prometheus.Labels) (Collector, error)
NewDiskstatsCollector returns a new Collector exposing disk device stats. Docs from https://www.kernel.org/doc/Documentation/iostats.txt and https://www.kernel.org/doc/Documentation/ABI/testing/procfs-diskstats
func NewFilesystemCollector ¶
func NewFilesystemCollector(labels prometheus.Labels) (Collector, error)
NewFilesystemCollector returns a new Collector exposing filesystem stats.
func NewLoadAverageCollector ¶
func NewLoadAverageCollector(labels prometheus.Labels) (Collector, error)
NewLoadAverageCollector returns a new Collector exposing load average statistics.
func NewMeminfoCollector ¶
func NewMeminfoCollector(labels prometheus.Labels) (Collector, error)
NewMeminfoCollector returns a new Collector exposing memory stats.
func NewNetdevCollector ¶
func NewNetdevCollector(labels prometheus.Labels) (Collector, error)
NewNetdevCollector returns a new Collector exposing network interfaces stats.
func NewNetworkCollector ¶
func NewNetworkCollector(labels prometheus.Labels) (Collector, error)
func NewPgbouncerPoolsCollector ¶
func NewPgbouncerPoolsCollector(constLabels prometheus.Labels) (Collector, error)
NewPgbouncerPoolsCollector returns a new Collector exposing pgbouncer pools connections usage stats. For details see https://www.pgbouncer.org/usage.html#show-pools.
func NewPgbouncerSettingsCollector ¶
func NewPgbouncerSettingsCollector(constLabels prometheus.Labels) (Collector, error)
NewPgbouncerSettingsCollector returns a new Collector exposing pgbouncer configuration. For details see https://www.pgbouncer.org/usage.html#show-config.
func NewPgbouncerStatsCollector ¶
func NewPgbouncerStatsCollector(constLabels prometheus.Labels) (Collector, error)
NewPgbouncerStatsCollector returns a new Collector exposing pgbouncer pools usage stats (except averages). For details see https://www.pgbouncer.org/usage.html#show-stats.
func NewPgscvServicesCollector ¶
func NewPgscvServicesCollector(labels prometheus.Labels) (Collector, error)
NewPgscvServicesCollector creates new collector.
func NewPostgresActivityCollector ¶
func NewPostgresActivityCollector(constLabels prometheus.Labels) (Collector, error)
NewPostgresActivityCollector returns a new Collector exposing postgres databases stats. For details see 1. https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-ACTIVITY-VIEW 2. https://www.postgresql.org/docs/current/view-pg-prepared-xacts.html
func NewPostgresBgwriterCollector ¶
func NewPostgresBgwriterCollector(constLabels prometheus.Labels) (Collector, error)
NewPostgresBgwriterCollector returns a new Collector exposing postgres bgwriter and checkpointer stats. For details see https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-BGWRITER-VIEW
func NewPostgresConflictsCollector ¶
func NewPostgresConflictsCollector(constLabels prometheus.Labels) (Collector, error)
NewPostgresConflictsCollector returns a new Collector exposing postgres databases recovery conflicts stats. For details see https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-DATABASE-CONFLICTS-VIEW
func NewPostgresDatabasesCollector ¶
func NewPostgresDatabasesCollector(constLabels prometheus.Labels) (Collector, error)
NewPostgresDatabasesCollector returns a new Collector exposing postgres databases stats. For details see https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-DATABASE-VIEW
func NewPostgresFunctionsCollector ¶
func NewPostgresFunctionsCollector(constLabels prometheus.Labels) (Collector, error)
NewPostgresFunctionsCollector returns a new Collector exposing postgres SQL functions stats. For details see https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-USER-FUNCTIONS-VIEW
func NewPostgresIndexesCollector ¶
func NewPostgresIndexesCollector(constLabels prometheus.Labels) (Collector, error)
NewPostgresIndexesCollector returns a new Collector exposing postgres indexes stats. For details see https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-ALL-INDEXES-VIEW https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STATIO-ALL-INDEXES-VIEW
func NewPostgresLocksCollector ¶
func NewPostgresLocksCollector(constLabels prometheus.Labels) (Collector, error)
NewPostgresLocksCollector creates new postgresLocksCollector.
func NewPostgresLogsCollector ¶
func NewPostgresLogsCollector(constLabels prometheus.Labels) (Collector, error)
NewPostgresLogsCollector creates new collector for Postgres log messages.
func NewPostgresReplicationCollector ¶
func NewPostgresReplicationCollector(constLabels prometheus.Labels) (Collector, error)
NewPostgresReplicationCollector returns a new Collector exposing postgres replication stats. For details see https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-REPLICATION-VIEW
func NewPostgresReplicationSlotsCollector ¶
func NewPostgresReplicationSlotsCollector(constLabels prometheus.Labels) (Collector, error)
NewPostgresReplicationSlotCollector returns a new Collector exposing postgres replication slots stats. For details see https://www.postgresql.org/docs/current/view-pg-replication-slots.html
func NewPostgresSchemasCollector ¶
func NewPostgresSchemasCollector(constLabels prometheus.Labels) (Collector, error)
NewPostgresSchemaCollector returns a new Collector exposing postgres schema stats. Stats are based on different sources inside system catalog.
func NewPostgresSettingsCollector ¶
func NewPostgresSettingsCollector(constLabels prometheus.Labels) (Collector, error)
NewPostgresSettingsCollector returns a new Collector exposing postgres settings stats. For details see https://www.postgresql.org/docs/current/view-pg-settings.html and https://www.postgresql.org/docs/current/view-pg-file-settings.html
func NewPostgresStatementsCollector ¶
func NewPostgresStatementsCollector(constLabels prometheus.Labels) (Collector, error)
NewPostgresStatementsCollector returns a new Collector exposing postgres statements stats. For details see https://www.postgresql.org/docs/current/pgstatstatements.html
func NewPostgresStorageCollector ¶
func NewPostgresStorageCollector(constLabels prometheus.Labels) (Collector, error)
NewPostgresStorageCollector returns a new Collector exposing various stats related to Postgres storage layer. This stats observed using different stats sources.
func NewPostgresTablesCollector ¶
func NewPostgresTablesCollector(constLabels prometheus.Labels) (Collector, error)
NewPostgresTablesCollector returns a new Collector exposing postgres tables stats. For details see https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STAT-ALL-TABLES-VIEW https://www.postgresql.org/docs/current/monitoring-stats.html#PG-STATIO-ALL-TABLES-VIEW
func NewSysconfigCollector ¶
func NewSysconfigCollector(labels prometheus.Labels) (Collector, error)
NewSystemCollector returns a new Collector exposing system-wide stats.
type Config ¶
type Config struct {
// ServiceType defines the type of discovered service. Depending on the type there should be different settings or
// settings-specifics metric collection usecases.
ServiceType string
// ConnString defines a connection string used to connecting to the service
ConnString string
// NoTrackMode controls collector to gather and send sensitive information, such as queries texts.
NoTrackMode bool
// PostgresServiceConfig defines collector's options specific for Postgres service
PostgresServiceConfig
// Filters are user-defined regular expressions allow to include/exclude collecting various stats.
Filters map[string]filter.Filter
}
Config defines collector configuration settings
type Factories ¶
type Factories map[string]func(prometheus.Labels) (Collector, error)
Factories defines collector functions which used for collecting metrics.
func (Factories) RegisterPgbouncerCollectors ¶
RegisterPgbouncerCollectors unions all pgbouncer-related collectors and registers them in single place.
func (Factories) RegisterPostgresCollectors ¶
RegisterPostgresCollectors unions all postgres-related collectors and registers them in single place.
func (Factories) RegisterSystemCollectors ¶
RegisterSystemCollectors unions all system-related collectors and registers them in single place.
type PgscvCollector ¶
type PgscvCollector struct {
Config Config
Collectors map[string]Collector
// contains filtered or unexported fields
}
Collector implements the prometheus.Collector interface.
func NewPgscvCollector ¶
func NewPgscvCollector(serviceID string, factories Factories, config Config) (*PgscvCollector, error)
NewPgscvCollector accepts Factories and creates per-service instance of Collector.
func (PgscvCollector) Collect ¶
func (n PgscvCollector) Collect(out chan<- prometheus.Metric)
Collect implements the prometheus.Collector interface.
func (PgscvCollector) Describe ¶
func (n PgscvCollector) Describe(ch chan<- *prometheus.Desc)
Describe implements the prometheus.Collector interface.
type PostgresServiceConfig ¶
type PostgresServiceConfig struct {
// BlockSize defines size of data block Postgres operates.
BlockSize int
// ServerVersionNum defines version of Postgres in XXYYZZ format.
ServerVersionNum int
// DataDirectory defines filesystem path where Postgres' data files and directories resides.
DataDirectory string
// LoggingCollector defines value of 'logging_collector' GUC.
LoggingCollector bool
// PgStatStatements defines is pg_stat_statements available in shared_preload_libraries and available for queries
PgStatStatements bool
// PgStatStatementsSource defines the database name where pg_stat_statements is available
PgStatStatementsSource string
}
PostgresServiceConfig defines Postgres-specific stuff required during collecting Postgres metrics.
func NewPostgresServiceConfig ¶
func NewPostgresServiceConfig(connStr string) (PostgresServiceConfig, error)
NewPostgresServiceConfig defines new config for Postgres-based collectors
Source Files
¶
- collector.go
- collector_common.go
- config.go
- filesystem_common.go
- linux_cpu.go
- linux_diskstats.go
- linux_filesystem.go
- linux_load_average.go
- linux_memory.go
- linux_netdev.go
- linux_network.go
- linux_sysconfig.go
- pgbouncer_pools.go
- pgbouncer_settings.go
- pgbouncer_stats.go
- pgscv_services.go
- postgres_activity.go
- postgres_bgwriter.go
- postgres_common.go
- postgres_conflicts.go
- postgres_database.go
- postgres_functions.go
- postgres_indexes.go
- postgres_locks.go
- postgres_logs.go
- postgres_replication.go
- postgres_replication_slots.go
- postgres_schema.go
- postgres_settings.go
- postgres_statements.go
- postgres_storage.go
- postgres_tables.go
- strings.go
- testing.go