collector

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exporter

type Exporter struct {
	// contains filtered or unexported fields
}

Exporter collects MySQL metrics. It implements prometheus.Collector.

func New

func New(ctx context.Context, pgoptions []pgdriver.Option, metrics Metrics, scrapers []Scraper) *Exporter

New returns a PostgreSQL exporter for the provided DSN.

func (*Exporter) Collect

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

Collect implements prometheus.Collector.

func (*Exporter) Describe

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

Describe implements prometheus.Collector.

type Metrics

type Metrics struct {
	TotalScrapes prometheus.Counter
	ScrapeErrors *prometheus.CounterVec
	Error        prometheus.Gauge
	PgSQLUp      prometheus.Gauge
}

Metrics represents exporter metrics which values can be carried between http requests.

func NewMetrics

func NewMetrics() Metrics

NewMetrics creates new Metrics instance.

type ScrapeActivity

type ScrapeActivity struct{}

ScrapeActivity scrapes from pg_stat_bgwriter

func (ScrapeActivity) Help

func (ScrapeActivity) Help() string

Help describes the role of the Scraper

func (ScrapeActivity) Name

func (ScrapeActivity) Name() string

Name of the Scraper

func (ScrapeActivity) Scrape

func (ScrapeActivity) Scrape(ctx context.Context, db *bun.DB, ch chan<- prometheus.Metric) error

Scrape collects data from database connection and sends it over channel as prometheus metric.

func (ScrapeActivity) Type

func (ScrapeActivity) Type() ScrapeType

Type returns the scrape type

func (ScrapeActivity) Version

func (ScrapeActivity) Version() int

Version returns minimum PostgreSQL version

type ScrapeArchiver

type ScrapeArchiver struct{}

ScrapeArchiver scrapes from pg_stat_archiver

func (ScrapeArchiver) Help

func (ScrapeArchiver) Help() string

Help describes the role of the Scraper

func (ScrapeArchiver) Name

func (ScrapeArchiver) Name() string

Name of the Scraper

func (ScrapeArchiver) Scrape

func (ScrapeArchiver) Scrape(ctx context.Context, db *bun.DB, ch chan<- prometheus.Metric) error

Scrape collects data from database connection and sends it over channel as prometheus metric.

func (ScrapeArchiver) Type

func (ScrapeArchiver) Type() ScrapeType

Type returns the scrape type

func (ScrapeArchiver) Version

func (ScrapeArchiver) Version() int

Version returns minimum PostgreSQL version

type ScrapeBgWriter

type ScrapeBgWriter struct{}

ScrapeBgWriter scrapes from pg_stat_bgwriter

func (ScrapeBgWriter) Help

func (ScrapeBgWriter) Help() string

Help describes the role of the Scraper

func (ScrapeBgWriter) Name

func (ScrapeBgWriter) Name() string

Name of the Scraper

func (ScrapeBgWriter) Scrape

func (ScrapeBgWriter) Scrape(ctx context.Context, db *bun.DB, ch chan<- prometheus.Metric) error

Scrape collects data from database connection and sends it over channel as prometheus metric.

func (ScrapeBgWriter) Type

func (ScrapeBgWriter) Type() ScrapeType

Type returns the scrape type

func (ScrapeBgWriter) Version

func (ScrapeBgWriter) Version() int

Version returns minimum PostgreSQL version

type ScrapeDatabase

type ScrapeDatabase struct{}

ScrapeDatabase scrapes from pg_stat_database

func (ScrapeDatabase) Help

func (ScrapeDatabase) Help() string

Help describes the role of the Scraper

func (ScrapeDatabase) Name

func (ScrapeDatabase) Name() string

Name of the Scraper

func (ScrapeDatabase) Scrape

func (ScrapeDatabase) Scrape(ctx context.Context, db *bun.DB, ch chan<- prometheus.Metric) error

Scrape collects data from database connection and sends it over channel as prometheus metric.

func (ScrapeDatabase) Type

func (ScrapeDatabase) Type() ScrapeType

Type returns the scrape type

func (ScrapeDatabase) Version

func (ScrapeDatabase) Version() int

Version returns minimum PostgreSQL version

type ScrapeDatabaseConflicts

type ScrapeDatabaseConflicts struct{}

ScrapeDatabaseConflicts scrapes from pg_stat_database_conflicts

func (ScrapeDatabaseConflicts) Help

Help describes the role of the Scraper

func (ScrapeDatabaseConflicts) Name

Name of the Scraper

func (ScrapeDatabaseConflicts) Scrape

func (ScrapeDatabaseConflicts) Scrape(ctx context.Context, db *bun.DB, ch chan<- prometheus.Metric) error

Scrape collects data from database connection and sends it over channel as prometheus metric.

func (ScrapeDatabaseConflicts) Type

Type returns the scrape type

func (ScrapeDatabaseConflicts) Version

func (ScrapeDatabaseConflicts) Version() int

Version returns minimum PostgreSQL version

type ScrapeIOTables

type ScrapeIOTables struct{}

ScrapeIOTables scrapes from pg_statio_user_tables

func (ScrapeIOTables) Help

func (ScrapeIOTables) Help() string

Help describes the role of the Scraper

func (ScrapeIOTables) Name

func (ScrapeIOTables) Name() string

Name of the Scraper

func (ScrapeIOTables) Scrape

func (ScrapeIOTables) Scrape(ctx context.Context, db *bun.DB, ch chan<- prometheus.Metric) error

Scrape collects data from database connection and sends it over channel as prometheus metric.

func (ScrapeIOTables) Type

func (ScrapeIOTables) Type() ScrapeType

Type returns the scrape type

func (ScrapeIOTables) Version

func (ScrapeIOTables) Version() int

Version returns minimum PostgreSQL version

type ScrapeInfo

type ScrapeInfo struct{}

ScrapeInfo scrapes generic PostgreSQL information

func (ScrapeInfo) Help

func (ScrapeInfo) Help() string

Help describes the role of the Scraper

func (ScrapeInfo) Name

func (ScrapeInfo) Name() string

Name of the Scraper

func (ScrapeInfo) Scrape

func (ScrapeInfo) Scrape(ctx context.Context, db *bun.DB, ch chan<- prometheus.Metric) error

Scrape collects data from database connection and sends it over channel as prometheus metric.

func (ScrapeInfo) Type

func (ScrapeInfo) Type() ScrapeType

Type returns the scrape type

func (ScrapeInfo) Version

func (ScrapeInfo) Version() int

Version returns minimum PostgreSQL version

type ScrapeLocks

type ScrapeLocks struct{}

ScrapeLocks scrapes from pg_locks

func (ScrapeLocks) Help

func (ScrapeLocks) Help() string

Help describes the role of the Scraper

func (ScrapeLocks) Name

func (ScrapeLocks) Name() string

Name of the Scraper

func (ScrapeLocks) Scrape

func (ScrapeLocks) Scrape(ctx context.Context, db *bun.DB, ch chan<- prometheus.Metric) error

Scrape collects data from database connection and sends it over channel as prometheus metric.

func (ScrapeLocks) Type

func (ScrapeLocks) Type() ScrapeType

Type returns the scrape type

func (ScrapeLocks) Version

func (ScrapeLocks) Version() int

Version returns minimum PostgreSQL version

type ScrapePreparedXacts

type ScrapePreparedXacts struct{}

ScrapePreparedXacts scrapes from pg_prepared_xacts

func (ScrapePreparedXacts) Help

func (ScrapePreparedXacts) Help() string

Help describes the role of the Scraper

func (ScrapePreparedXacts) Name

func (ScrapePreparedXacts) Name() string

Name of the Scraper

func (ScrapePreparedXacts) Scrape

func (ScrapePreparedXacts) Scrape(ctx context.Context, db *bun.DB, ch chan<- prometheus.Metric) error

Scrape collects data from database connection and sends it over channel as prometheus metric.

func (ScrapePreparedXacts) Type

Type returns the scrape type

func (ScrapePreparedXacts) Version

func (ScrapePreparedXacts) Version() int

Version returns minimum PostgreSQL version

type ScrapeReplication

type ScrapeReplication struct{}

ScrapeReplication scrapes from pg_stat_replication

func (ScrapeReplication) Help

func (ScrapeReplication) Help() string

Help describes the role of the Scraper

func (ScrapeReplication) Name

func (ScrapeReplication) Name() string

Name of the Scraper

func (ScrapeReplication) Scrape

func (ScrapeReplication) Scrape(ctx context.Context, db *bun.DB, ch chan<- prometheus.Metric) error

Scrape collects data from database connection and sends it over channel as prometheus metric.

func (ScrapeReplication) Type

Type returns the scrape type

func (ScrapeReplication) Version

func (ScrapeReplication) Version() int

Version returns minimum PostgreSQL version

type ScrapeReplicationSlots

type ScrapeReplicationSlots struct{}

ScrapeReplicationSlots scrapes from pg_stat_replication_slots

func (ScrapeReplicationSlots) Help

Help describes the role of the Scraper

func (ScrapeReplicationSlots) Name

Name of the Scraper

func (ScrapeReplicationSlots) Scrape

func (ScrapeReplicationSlots) Scrape(ctx context.Context, db *bun.DB, ch chan<- prometheus.Metric) error

Scrape collects data from database connection and sends it over channel as prometheus metric.

func (ScrapeReplicationSlots) Type

Type returns the scrape type

func (ScrapeReplicationSlots) Version

func (ScrapeReplicationSlots) Version() int

Version returns minimum PostgreSQL version

type ScrapeSettings

type ScrapeSettings struct{}

ScrapeSettings scrapes from pg_settings

func (ScrapeSettings) Help

func (ScrapeSettings) Help() string

Help describes the role of the Scraper

func (ScrapeSettings) Name

func (ScrapeSettings) Name() string

Name of the Scraper

func (ScrapeSettings) Scrape

func (ScrapeSettings) Scrape(ctx context.Context, db *bun.DB, ch chan<- prometheus.Metric) error

Scrape collects data from database connection and sends it over channel as prometheus metric.

func (ScrapeSettings) Type

func (ScrapeSettings) Type() ScrapeType

Type returns the scrape type

func (ScrapeSettings) Version

func (ScrapeSettings) Version() int

Version returns minimum PostgreSQL version

type ScrapeStatements

type ScrapeStatements struct{}

ScrapeStatements scrapes from pg_stat_statements

func (ScrapeStatements) Help

func (ScrapeStatements) Help() string

Help describes the role of the Scraper

func (ScrapeStatements) Name

func (ScrapeStatements) Name() string

Name of the Scraper

func (ScrapeStatements) Scrape

func (ScrapeStatements) Scrape(ctx context.Context, db *bun.DB, ch chan<- prometheus.Metric) error

Scrape collects data from database connection and sends it over channel as prometheus metric.

func (ScrapeStatements) Type

Type returns the scrape type

func (ScrapeStatements) Version

func (ScrapeStatements) Version() int

Version returns minimum PostgreSQL version

type ScrapeTXID

type ScrapeTXID struct{}

ScrapeTXID scrapes from txid_current()

func (ScrapeTXID) Help

func (ScrapeTXID) Help() string

Help describes the role of the Scraper

func (ScrapeTXID) Name

func (ScrapeTXID) Name() string

Name of the Scraper

func (ScrapeTXID) Scrape

func (ScrapeTXID) Scrape(ctx context.Context, db *bun.DB, ch chan<- prometheus.Metric) error

Scrape collects data from database connection and sends it over channel as prometheus metric.

func (ScrapeTXID) Type

func (ScrapeTXID) Type() ScrapeType

Type returns the scrape type

func (ScrapeTXID) Version

func (ScrapeTXID) Version() int

Version returns minimum PostgreSQL version

type ScrapeTables

type ScrapeTables struct{}

ScrapeTables scrapes from pg_stat_user_tables

func (ScrapeTables) Help

func (ScrapeTables) Help() string

Help describes the role of the Scraper

func (ScrapeTables) Name

func (ScrapeTables) Name() string

Name of the Scraper

func (ScrapeTables) Scrape

func (ScrapeTables) Scrape(ctx context.Context, db *bun.DB, ch chan<- prometheus.Metric) error

Scrape collects data from database connection and sends it over channel as prometheus metric.

func (ScrapeTables) Type

func (ScrapeTables) Type() ScrapeType

Type returns the scrape type

func (ScrapeTables) Version

func (ScrapeTables) Version() int

Version returns minimum PostgreSQL version

type ScrapeType

type ScrapeType int
const (
	SCRAPEGLOBAL ScrapeType = iota
	SCRAPELOCAL
)

type ScrapeWal

type ScrapeWal struct{}

ScrapeWal scrapes from pg_stat_wal

func (ScrapeWal) Help

func (ScrapeWal) Help() string

Help describes the role of the Scraper

func (ScrapeWal) Name

func (ScrapeWal) Name() string

Name of the Scraper

func (ScrapeWal) Scrape

func (ScrapeWal) Scrape(ctx context.Context, db *bun.DB, ch chan<- prometheus.Metric) error

Scrape collects data from database connection and sends it over channel as prometheus metric.

func (ScrapeWal) Type

func (ScrapeWal) Type() ScrapeType

Type returns the scrape type

func (ScrapeWal) Version

func (ScrapeWal) Version() int

Version returns minimum PostgreSQL version

type Scraper

type Scraper interface {
	// Name of the Scraper. Should be unique.
	Name() string

	// Help describes the role of the Scraper.
	Help() string

	// Version of PostgreSQL from which scraper is available.
	Version() int

	// Type defines the scrape type
	Type() ScrapeType

	// Scrape collects data from database connection and sends it over channel as prometheus metric.
	Scrape(ctx context.Context, db *bun.DB, ch chan<- prometheus.Metric) error
}

Scraper is minimal interface that let's you add new prometheus metrics to pg_exporter.

Directories

Path Synopsis
generated by binding gen
generated by binding gen

Jump to

Keyboard shortcuts

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