collector

package
v0.0.0-...-a4ce10b Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const InformationSchema = informationSchema
View Source
const Namespace = namespace
View Source
const VersionQuery = versionQuery

Variables

View Source
var (
	HeartbeatStoredDesc = prometheus.NewDesc(
		prometheus.BuildFQName(namespace, heartbeat, "stored_timestamp_seconds"),
		"Timestamp stored in the heartbeat table.",
		[]string{"server_id"}, nil,
	)
	HeartbeatNowDesc = prometheus.NewDesc(
		prometheus.BuildFQName(namespace, heartbeat, "now_timestamp_seconds"),
		"Timestamp of the current server.",
		[]string{"server_id"}, nil,
	)
)

Metric descriptors.

View Source
var (
	SlaveHostsInfo = prometheus.NewDesc(
		prometheus.BuildFQName(namespace, heartbeat, "mysql_slave_hosts_info"),
		"Information about running slaves",
		[]string{"server_id", "slave_host", "port", "master_id", "slave_uuid"}, nil,
	)
)

Metric descriptors.

Functions

func GetMySQLVersion

func GetMySQLVersion(db *sql.DB, logger log.Logger) float64

func NewDesc

func NewDesc(subsystem, name, help string) *prometheus.Desc

func ParseStatus

func ParseStatus(data sql.RawBytes) (float64, bool)

func ValidPrometheusName

func ValidPrometheusName(s string) string

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, db *sql.DB, 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(resolution string) 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 ScrapeClientStat

type ScrapeClientStat struct{}

ScrapeClientStat collects from `information_schema.client_statistics`.

func (ScrapeClientStat) Help

func (ScrapeClientStat) Help() string

Help describes the role of the Scraper.

func (ScrapeClientStat) Name

func (ScrapeClientStat) Name() string

Name of the Scraper. Should be unique.

func (ScrapeClientStat) Scrape

func (ScrapeClientStat) 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 (ScrapeClientStat) Version

func (ScrapeClientStat) 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 ScrapeEngineTokudbStatus

type ScrapeEngineTokudbStatus struct{}

ScrapeEngineTokudbStatus scrapes from `SHOW ENGINE TOKUDB STATUS`.

func (ScrapeEngineTokudbStatus) Help

Help describes the role of the Scraper.

func (ScrapeEngineTokudbStatus) Name

Name of the Scraper. Should be unique.

func (ScrapeEngineTokudbStatus) Scrape

func (ScrapeEngineTokudbStatus) 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 (ScrapeEngineTokudbStatus) 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 ScrapeGlobalVariables

type ScrapeGlobalVariables struct{}

ScrapeGlobalVariables collects from `SHOW GLOBAL VARIABLES`.

func (ScrapeGlobalVariables) Help

Help describes the role of the Scraper.

func (ScrapeGlobalVariables) Name

Name of the Scraper. Should be unique.

func (ScrapeGlobalVariables) Scrape

func (ScrapeGlobalVariables) 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 (ScrapeGlobalVariables) Version

func (ScrapeGlobalVariables) Version() float64

Version of MySQL from which scraper is available.

type ScrapeHeartbeat

type ScrapeHeartbeat struct{}

ScrapeHeartbeat scrapes from the heartbeat table. This is mainly targeting pt-heartbeat, but will work with any heartbeat implementation that writes to a table with two columns: CREATE TABLE heartbeat (

ts                    varchar(26) NOT NULL,
server_id             int unsigned NOT NULL PRIMARY KEY,

);

func (ScrapeHeartbeat) Help

func (ScrapeHeartbeat) Help() string

Help describes the role of the Scraper.

func (ScrapeHeartbeat) Name

func (ScrapeHeartbeat) Name() string

Name of the Scraper. Should be unique.

func (ScrapeHeartbeat) Scrape

func (ScrapeHeartbeat) 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 (ScrapeHeartbeat) Version

func (ScrapeHeartbeat) 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 ScrapeInnodbCmp

type ScrapeInnodbCmp struct{}

ScrapeInnodbCmp collects from `information_schema.innodb_cmp`.

func (ScrapeInnodbCmp) Help

func (ScrapeInnodbCmp) Help() string

Help describes the role of the Scraper.

func (ScrapeInnodbCmp) Name

func (ScrapeInnodbCmp) Name() string

Name of the Scraper. Should be unique.

func (ScrapeInnodbCmp) Scrape

func (ScrapeInnodbCmp) 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 (ScrapeInnodbCmp) Version

func (ScrapeInnodbCmp) Version() float64

Version of MySQL from which scraper is available.

type ScrapeInnodbCmpMem

type ScrapeInnodbCmpMem struct{}

ScrapeInnodbCmp collects from `information_schema.innodb_cmp`.

func (ScrapeInnodbCmpMem) Help

func (ScrapeInnodbCmpMem) Help() string

Help describes the role of the Scraper.

func (ScrapeInnodbCmpMem) Name

func (ScrapeInnodbCmpMem) Name() string

Name of the Scraper. Should be unique.

func (ScrapeInnodbCmpMem) Scrape

func (ScrapeInnodbCmpMem) 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 (ScrapeInnodbCmpMem) Version

func (ScrapeInnodbCmpMem) Version() float64

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 ScrapePerfEventsStatements

type ScrapePerfEventsStatements struct{}

ScrapePerfEventsStatements collects from `performance_schema.events_statements_summary_by_digest`.

func (ScrapePerfEventsStatements) Help

Help describes the role of the Scraper.

func (ScrapePerfEventsStatements) Name

Name of the Scraper. Should be unique.

func (ScrapePerfEventsStatements) Scrape

func (ScrapePerfEventsStatements) 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 (ScrapePerfEventsStatements) Version

Version of MySQL from which scraper is available.

type ScrapePerfEventsStatementsSum

type ScrapePerfEventsStatementsSum struct{}

ScrapePerfEventsStatementsSum collects from `performance_schema.events_statements_summary_by_digest`.

func (ScrapePerfEventsStatementsSum) Help

Help describes the role of the Scraper.

func (ScrapePerfEventsStatementsSum) Name

Name of the Scraper. Should be unique.

func (ScrapePerfEventsStatementsSum) Scrape

func (ScrapePerfEventsStatementsSum) 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 (ScrapePerfEventsStatementsSum) Version

Version of MySQL from which scraper is available.

type ScrapePerfEventsWaits

type ScrapePerfEventsWaits struct{}

ScrapePerfEventsWaits collects from `performance_schema.events_waits_summary_global_by_event_name`.

func (ScrapePerfEventsWaits) Help

Help describes the role of the Scraper.

func (ScrapePerfEventsWaits) Name

Name of the Scraper. Should be unique.

func (ScrapePerfEventsWaits) Scrape

func (ScrapePerfEventsWaits) 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 (ScrapePerfEventsWaits) Version

func (ScrapePerfEventsWaits) Version() float64

Version of MySQL from which scraper is available.

type ScrapePerfFileEvents

type ScrapePerfFileEvents struct{}

ScrapePerfFileEvents collects from `performance_schema.file_summary_by_event_name`.

func (ScrapePerfFileEvents) Help

Help describes the role of the Scraper.

func (ScrapePerfFileEvents) Name

Name of the Scraper. Should be unique.

func (ScrapePerfFileEvents) Scrape

func (ScrapePerfFileEvents) 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 (ScrapePerfFileEvents) Version

func (ScrapePerfFileEvents) Version() float64

Version of MySQL from which scraper is available.

type ScrapePerfFileInstances

type ScrapePerfFileInstances struct{}

ScrapePerfFileInstances collects from `performance_schema.file_summary_by_instance`.

func (ScrapePerfFileInstances) Help

Help describes the role of the Scraper.

func (ScrapePerfFileInstances) Name

Name of the Scraper. Should be unique.

func (ScrapePerfFileInstances) Scrape

func (ScrapePerfFileInstances) 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 (ScrapePerfFileInstances) Version

func (ScrapePerfFileInstances) 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 ScrapePlugins

type ScrapePlugins struct{}

ScrapePlugins collects from `SHOW PLUGINS`.

func (ScrapePlugins) Help

func (ScrapePlugins) Help() string

Help describes the role of the Scraper.

func (ScrapePlugins) Name

func (ScrapePlugins) Name() string

Name of the Scraper. Should be unique.

func (ScrapePlugins) Scrape

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

func (ScrapePlugins) Version

func (ScrapePlugins) Version() float64

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 ScrapeQueryResponseTime

type ScrapeQueryResponseTime struct{}

ScrapeQueryResponseTime collects from `information_schema.query_response_time`.

func (ScrapeQueryResponseTime) Help

Help describes the role of the Scraper.

func (ScrapeQueryResponseTime) Name

Name of the Scraper. Should be unique.

func (ScrapeQueryResponseTime) Scrape

func (ScrapeQueryResponseTime) 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 (ScrapeQueryResponseTime) Version

func (ScrapeQueryResponseTime) Version() float64

Version of MySQL from which scraper is available.

type ScrapeReplicaHost

type ScrapeReplicaHost struct{}

ScrapeReplicaHost collects from `information_schema.replica_host_status`.

func (ScrapeReplicaHost) Help

func (ScrapeReplicaHost) Help() string

Help describes the role of the Scraper.

func (ScrapeReplicaHost) Name

func (ScrapeReplicaHost) Name() string

Name of the Scraper. Should be unique.

func (ScrapeReplicaHost) Scrape

func (ScrapeReplicaHost) 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 (ScrapeReplicaHost) Version

func (ScrapeReplicaHost) Version() float64

Version of MySQL from which scraper is available.

type ScrapeSchemaStat

type ScrapeSchemaStat struct{}

ScrapeSchemaStat collects from `information_schema.table_statistics` grouped by schema.

func (ScrapeSchemaStat) Help

func (ScrapeSchemaStat) Help() string

Help describes the role of the Scraper.

func (ScrapeSchemaStat) Name

func (ScrapeSchemaStat) Name() string

Name of the Scraper. Should be unique.

func (ScrapeSchemaStat) Scrape

func (ScrapeSchemaStat) 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 (ScrapeSchemaStat) Version

func (ScrapeSchemaStat) Version() float64

Version of MySQL from which scraper is available.

type ScrapeSlaveHosts

type ScrapeSlaveHosts struct{}

ScrapeSlaveHosts scrapes metrics about the replicating slaves.

func (ScrapeSlaveHosts) Help

func (ScrapeSlaveHosts) Help() string

Help describes the role of the Scraper.

func (ScrapeSlaveHosts) Name

func (ScrapeSlaveHosts) Name() string

Name of the Scraper. Should be unique.

func (ScrapeSlaveHosts) Scrape

func (ScrapeSlaveHosts) 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 (ScrapeSlaveHosts) Version

func (ScrapeSlaveHosts) 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) (e 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 ScrapeTableStat

type ScrapeTableStat struct{}

ScrapeTableStat collects from `information_schema.table_statistics`.

func (ScrapeTableStat) Help

func (ScrapeTableStat) Help() string

Help describes the role of the Scraper.

func (ScrapeTableStat) Name

func (ScrapeTableStat) Name() string

Name of the Scraper. Should be unique.

func (ScrapeTableStat) Scrape

func (ScrapeTableStat) 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 (ScrapeTableStat) Version

func (ScrapeTableStat) 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 ScrapeUserStat

type ScrapeUserStat struct{}

ScrapeUserStat collects from `information_schema.user_statistics`.

func (ScrapeUserStat) Help

func (ScrapeUserStat) Help() string

Help describes the role of the Scraper.

func (ScrapeUserStat) Name

func (ScrapeUserStat) Name() string

Name of the Scraper. Should be unique.

func (ScrapeUserStat) Scrape

func (ScrapeUserStat) 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 (ScrapeUserStat) Version

func (ScrapeUserStat) 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.

Notes

Bugs

Jump to

Keyboard shortcuts

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