collector

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: BSD-3-Clause Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
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

This section is empty.

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, _ model.CollectorSettings) (Collector, error)

NewCPUCollector returns a new Collector exposing kernel/system statistics.

func NewDiskstatsCollector

func NewDiskstatsCollector(labels prometheus.Labels, _ model.CollectorSettings) (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, _ model.CollectorSettings) (Collector, error)

NewFilesystemCollector returns a new Collector exposing filesystem stats.

func NewLoadAverageCollector

func NewLoadAverageCollector(labels prometheus.Labels, _ model.CollectorSettings) (Collector, error)

NewLoadAverageCollector returns a new Collector exposing load average statistics.

func NewMeminfoCollector

func NewMeminfoCollector(labels prometheus.Labels, _ model.CollectorSettings) (Collector, error)

NewMeminfoCollector returns a new Collector exposing memory stats.

func NewNetdevCollector

func NewNetdevCollector(labels prometheus.Labels, _ model.CollectorSettings) (Collector, error)

NewNetdevCollector returns a new Collector exposing network interfaces stats.

func NewNetworkCollector

func NewNetworkCollector(labels prometheus.Labels, _ model.CollectorSettings) (Collector, error)

func NewPgbouncerPoolsCollector

func NewPgbouncerPoolsCollector(constLabels prometheus.Labels, _ model.CollectorSettings) (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, _ model.CollectorSettings) (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, _ model.CollectorSettings) (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, _ model.CollectorSettings) (Collector, error)

NewPgscvServicesCollector creates new collector.

func NewPostgresActivityCollector

func NewPostgresActivityCollector(constLabels prometheus.Labels, _ model.CollectorSettings) (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, _ model.CollectorSettings) (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, _ model.CollectorSettings) (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 NewPostgresCustomCollector added in v0.4.23

func NewPostgresCustomCollector(constLabels prometheus.Labels, settings model.CollectorSettings) (Collector, error)

NewPostgresCustomCollector returns a new Collector that expose user-defined postgres metrics.

func NewPostgresDatabasesCollector

func NewPostgresDatabasesCollector(constLabels prometheus.Labels, _ model.CollectorSettings) (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, _ model.CollectorSettings) (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 NewPostgresLocksCollector

func NewPostgresLocksCollector(constLabels prometheus.Labels, _ model.CollectorSettings) (Collector, error)

NewPostgresLocksCollector creates new postgresLocksCollector.

func NewPostgresLogsCollector

func NewPostgresLogsCollector(constLabels prometheus.Labels, _ model.CollectorSettings) (Collector, error)

NewPostgresLogsCollector creates new collector for Postgres log messages.

func NewPostgresReplicationCollector

func NewPostgresReplicationCollector(constLabels prometheus.Labels, _ model.CollectorSettings) (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, _ model.CollectorSettings) (Collector, error)

NewPostgresReplicationSlotsCollector 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, _ model.CollectorSettings) (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, _ model.CollectorSettings) (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, _ model.CollectorSettings) (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, _ model.CollectorSettings) (Collector, error)

NewPostgresStorageCollector returns a new Collector exposing various stats related to Postgres storage layer. This stats observed using different stats sources.

func NewPostgresWalArchivingCollector added in v0.4.16

func NewPostgresWalArchivingCollector(constLabels prometheus.Labels, _ model.CollectorSettings) (Collector, error)

NewPostgresWalArchivingCollector returns a new Collector exposing postgres WAL archiving stats. For details see https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ARCHIVER-VIEW

func NewSysconfigCollector

func NewSysconfigCollector(labels prometheus.Labels, _ model.CollectorSettings) (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
	// DatabasesRE defines regexp with databases from which builtin metrics should be collected.
	DatabasesRE *regexp.Regexp
	// Filters are user-defined regular expressions allow to include/exclude collecting various stats.
	Filters map[string]filter.Filter
	// Settings defines collectors settings propagated from main YAML configuration.
	Settings model.CollectorsSettings
}

Config defines collector's global configuration.

type Factories

Factories defines collector functions which used for collecting metrics.

func (Factories) RegisterPgbouncerCollectors

func (f Factories) RegisterPgbouncerCollectors(disabled []string)

RegisterPgbouncerCollectors unions all pgbouncer-related collectors and registers them in single place.

func (Factories) RegisterPostgresCollectors

func (f Factories) RegisterPostgresCollectors(disabled []string)

RegisterPostgresCollectors unions all postgres-related collectors and registers them in single place.

func (Factories) RegisterSystemCollectors

func (f Factories) RegisterSystemCollectors(disabled []string)

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 uint64
	// WalSegmentSize defines size of WAL segment Postgres operates.
	WalSegmentSize uint64
	// 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
	// PgStatStatementsDatabase defines the database name where pg_stat_statements is available
	PgStatStatementsDatabase string
	// PgStatStatementsSchema defines the schema name where pg_stat_statements is installed
	PgStatStatementsSchema 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

Jump to

Keyboard shortcuts

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