collector

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: Apache-2.0 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, dsn string, metrics Metrics, scrapers []Scraper, logger log.Logger) *Exporter

New returns a new MySQL 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
	MySQLUp      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 ScrapeAutoIncrementColumns

type ScrapeAutoIncrementColumns struct{}

ScrapeAutoIncrementColumns collects auto_increment column information.

func (ScrapeAutoIncrementColumns) Help

Help describes the role of the Scraper.

func (ScrapeAutoIncrementColumns) Name

Name of the Scraper. Should be unique.

func (ScrapeAutoIncrementColumns) Scrape

func (ScrapeAutoIncrementColumns) Scrape(ctx context.Context, db *sql.DB, ch chan<- prometheus.Metric, logger log.Logger) error

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

func (ScrapeAutoIncrementColumns) Version

Version of MySQL from which scraper is available.

type ScrapeBinlogSize

type ScrapeBinlogSize struct{}

ScrapeBinlogSize colects from `SHOW BINARY LOGS`.

func (ScrapeBinlogSize) Help

func (ScrapeBinlogSize) Help() string

Help describes the role of the Scraper.

func (ScrapeBinlogSize) Name

func (ScrapeBinlogSize) Name() string

Name of the Scraper. Should be unique.

func (ScrapeBinlogSize) Scrape

func (ScrapeBinlogSize) Scrape(ctx context.Context, db *sql.DB, ch chan<- prometheus.Metric, logger log.Logger) error

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

func (ScrapeBinlogSize) Version

func (ScrapeBinlogSize) Version() float64

Version of MySQL from which scraper is available.

type ScrapeEngineInnodbStatus

type ScrapeEngineInnodbStatus struct{}

ScrapeEngineInnodbStatus scrapes from `SHOW ENGINE INNODB STATUS`.

func (ScrapeEngineInnodbStatus) Help

Help describes the role of the Scraper.

func (ScrapeEngineInnodbStatus) Name

Name of the Scraper. Should be unique.

func (ScrapeEngineInnodbStatus) Scrape

func (ScrapeEngineInnodbStatus) Scrape(ctx context.Context, db *sql.DB, ch chan<- prometheus.Metric, logger log.Logger) error

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

func (ScrapeEngineInnodbStatus) Version

Version of MySQL from which scraper is available.

type ScrapeGlobalStatus

type ScrapeGlobalStatus struct{}

ScrapeGlobalStatus collects from `SHOW GLOBAL STATUS`.

func (ScrapeGlobalStatus) Help

func (ScrapeGlobalStatus) Help() string

Help describes the role of the Scraper.

func (ScrapeGlobalStatus) Name

func (ScrapeGlobalStatus) Name() string

Name of the Scraper. Should be unique.

func (ScrapeGlobalStatus) Scrape

func (ScrapeGlobalStatus) Scrape(ctx context.Context, db *sql.DB, ch chan<- prometheus.Metric, logger log.Logger) error

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

func (ScrapeGlobalStatus) Version

func (ScrapeGlobalStatus) Version() float64

Version of MySQL from which scraper is available.

type ScrapeInfoSchemaInnodbTablespaces

type ScrapeInfoSchemaInnodbTablespaces struct{}

ScrapeInfoSchemaInnodbTablespaces collects from `information_schema.innodb_sys_tablespaces`.

func (ScrapeInfoSchemaInnodbTablespaces) Help

Help describes the role of the Scraper.

func (ScrapeInfoSchemaInnodbTablespaces) Name

Name of the Scraper. Should be unique.

func (ScrapeInfoSchemaInnodbTablespaces) Scrape

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

func (ScrapeInfoSchemaInnodbTablespaces) Version

Version of MySQL from which scraper is available.

type ScrapeInnodbMetrics

type ScrapeInnodbMetrics struct{}

ScrapeInnodbMetrics collects from `information_schema.innodb_metrics`.

func (ScrapeInnodbMetrics) Help

func (ScrapeInnodbMetrics) Help() string

Help describes the role of the Scraper.

func (ScrapeInnodbMetrics) Name

func (ScrapeInnodbMetrics) Name() string

Name of the Scraper. Should be unique.

func (ScrapeInnodbMetrics) Scrape

func (ScrapeInnodbMetrics) Scrape(ctx context.Context, db *sql.DB, ch chan<- prometheus.Metric, logger log.Logger) error

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

func (ScrapeInnodbMetrics) Version

func (ScrapeInnodbMetrics) Version() float64

Version of MySQL from which scraper is available.

type ScrapePerfIndexIOWaits

type ScrapePerfIndexIOWaits struct{}

ScrapePerfIndexIOWaits collects for `performance_schema.table_io_waits_summary_by_index_usage`.

func (ScrapePerfIndexIOWaits) Help

Help describes the role of the Scraper.

func (ScrapePerfIndexIOWaits) Name

Name of the Scraper. Should be unique.

func (ScrapePerfIndexIOWaits) Scrape

func (ScrapePerfIndexIOWaits) Scrape(ctx context.Context, db *sql.DB, ch chan<- prometheus.Metric, logger log.Logger) error

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

func (ScrapePerfIndexIOWaits) Version

func (ScrapePerfIndexIOWaits) Version() float64

Version of MySQL from which scraper is available.

type ScrapePerfMemoryEvents

type ScrapePerfMemoryEvents struct{}

ScrapePerfMemoryEvents collects from `performance_schema.memory_summary_global_by_event_name`.

func (ScrapePerfMemoryEvents) Help

Help describes the role of the Scraper.

func (ScrapePerfMemoryEvents) Name

Name of the Scraper. Should be unique.

func (ScrapePerfMemoryEvents) Scrape

func (ScrapePerfMemoryEvents) Scrape(ctx context.Context, db *sql.DB, ch chan<- prometheus.Metric, logger log.Logger) error

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

func (ScrapePerfMemoryEvents) Version

func (ScrapePerfMemoryEvents) Version() float64

Version of MySQL from which scraper is available.

type ScrapePerfReplicationApplierStatsByWorker

type ScrapePerfReplicationApplierStatsByWorker struct{}

ScrapePerfReplicationApplierStatsByWorker collects from `performance_schema.replication_applier_status_by_worker`.

func (ScrapePerfReplicationApplierStatsByWorker) Help

Help describes the role of the Scraper.

func (ScrapePerfReplicationApplierStatsByWorker) Name

Name of the Scraper. Should be unique.

func (ScrapePerfReplicationApplierStatsByWorker) Scrape

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

func (ScrapePerfReplicationApplierStatsByWorker) Version

Version of MySQL from which scraper is available.

type ScrapePerfReplicationGroupMemberStats

type ScrapePerfReplicationGroupMemberStats struct{}

ScrapePerfReplicationGroupMemberStats collects from `performance_schema.replication_group_member_stats`.

func (ScrapePerfReplicationGroupMemberStats) Help

Help describes the role of the Scraper.

func (ScrapePerfReplicationGroupMemberStats) Name

Name of the Scraper. Should be unique.

func (ScrapePerfReplicationGroupMemberStats) Scrape

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

func (ScrapePerfReplicationGroupMemberStats) Version

Version of MySQL from which scraper is available.

type ScrapePerfReplicationGroupMembers

type ScrapePerfReplicationGroupMembers struct{}

ScrapeReplicationGroupMembers collects from `performance_schema.replication_group_members`.

func (ScrapePerfReplicationGroupMembers) Help

Help describes the role of the Scraper.

func (ScrapePerfReplicationGroupMembers) Name

Name of the Scraper. Should be unique.

func (ScrapePerfReplicationGroupMembers) Scrape

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

func (ScrapePerfReplicationGroupMembers) Version

Version of MySQL from which scraper is available.

type ScrapePerfTableIOWaits

type ScrapePerfTableIOWaits struct{}

ScrapePerfTableIOWaits collects from `performance_schema.table_io_waits_summary_by_table`.

func (ScrapePerfTableIOWaits) Help

Help describes the role of the Scraper.

func (ScrapePerfTableIOWaits) Name

Name of the Scraper. Should be unique.

func (ScrapePerfTableIOWaits) Scrape

func (ScrapePerfTableIOWaits) Scrape(ctx context.Context, db *sql.DB, ch chan<- prometheus.Metric, logger log.Logger) error

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

func (ScrapePerfTableIOWaits) Version

func (ScrapePerfTableIOWaits) Version() float64

Version of MySQL from which scraper is available.

type ScrapePerfTableLockWaits

type ScrapePerfTableLockWaits struct{}

ScrapePerfTableLockWaits collects from `performance_schema.table_lock_waits_summary_by_table`.

func (ScrapePerfTableLockWaits) Help

Help describes the role of the Scraper.

func (ScrapePerfTableLockWaits) Name

Name of the Scraper. Should be unique.

func (ScrapePerfTableLockWaits) Scrape

func (ScrapePerfTableLockWaits) Scrape(ctx context.Context, db *sql.DB, ch chan<- prometheus.Metric, logger log.Logger) error

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

func (ScrapePerfTableLockWaits) Version

Version of MySQL from which scraper is available.

type ScrapeProcesslist

type ScrapeProcesslist struct{}

ScrapeProcesslist collects from `information_schema.processlist`.

func (ScrapeProcesslist) Help

func (ScrapeProcesslist) Help() string

Help describes the role of the Scraper.

func (ScrapeProcesslist) Name

func (ScrapeProcesslist) Name() string

Name of the Scraper. Should be unique.

func (ScrapeProcesslist) Scrape

func (ScrapeProcesslist) Scrape(ctx context.Context, db *sql.DB, ch chan<- prometheus.Metric, logger log.Logger) error

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

func (ScrapeProcesslist) Version

func (ScrapeProcesslist) Version() float64

Version of MySQL from which scraper is available.

type ScrapeSlaveStatus

type ScrapeSlaveStatus struct{}

ScrapeSlaveStatus collects from `SHOW SLAVE STATUS`.

func (ScrapeSlaveStatus) Help

func (ScrapeSlaveStatus) Help() string

Help describes the role of the Scraper.

func (ScrapeSlaveStatus) Name

func (ScrapeSlaveStatus) Name() string

Name of the Scraper. Should be unique.

func (ScrapeSlaveStatus) Scrape

func (ScrapeSlaveStatus) Scrape(ctx context.Context, db *sql.DB, ch chan<- prometheus.Metric, logger log.Logger) error

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

func (ScrapeSlaveStatus) Version

func (ScrapeSlaveStatus) Version() float64

Version of MySQL from which scraper is available.

type ScrapeTableSchema

type ScrapeTableSchema struct{}

ScrapeTableSchema collects from `information_schema.tables`.

func (ScrapeTableSchema) Help

func (ScrapeTableSchema) Help() string

Help describes the role of the Scraper.

func (ScrapeTableSchema) Name

func (ScrapeTableSchema) Name() string

Name of the Scraper. Should be unique.

func (ScrapeTableSchema) Scrape

func (ScrapeTableSchema) Scrape(ctx context.Context, db *sql.DB, ch chan<- prometheus.Metric, logger log.Logger) error

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

func (ScrapeTableSchema) Version

func (ScrapeTableSchema) Version() float64

Version of MySQL from which scraper is available.

type ScrapeUser

type ScrapeUser struct{}

ScrapeUser collects from `information_schema.processlist`.

func (ScrapeUser) Help

func (ScrapeUser) Help() string

Help describes the role of the Scraper.

func (ScrapeUser) Name

func (ScrapeUser) Name() string

Name of the Scraper. Should be unique.

func (ScrapeUser) Scrape

func (ScrapeUser) Scrape(ctx context.Context, db *sql.DB, ch chan<- prometheus.Metric, logger log.Logger) error

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

func (ScrapeUser) Version

func (ScrapeUser) Version() float64

Version of MySQL from which scraper is available.

type Scraper

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

	// Help describes the role of the Scraper.
	// Example: "Collect from SHOW ENGINE INNODB STATUS"
	Help() string

	// Version of MySQL from which scraper is available.
	Version() float64

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

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

Jump to

Keyboard shortcuts

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