You've already forked mysqld_exporter
mirror of
https://github.com/prometheus/mysqld_exporter.git
synced 2025-07-30 06:43:05 +03:00
Add the instance struct to handle connections (#859)
The intent is to use the instance struct to hold the connection to the database as well as metadata about the instance: - version - flavor (mariadb or mysql) Change is similar to prometheus-community/postgres_exporter#785 Signed-off-by: Vlad Gusev <vlad.esten@gmail.com>
This commit is contained in:
@ -120,7 +120,8 @@ func (ScrapeUser) Version() float64 {
|
||||
}
|
||||
|
||||
// Scrape collects data from database connection and sends it over channel as prometheus metric.
|
||||
func (ScrapeUser) Scrape(ctx context.Context, db *sql.DB, ch chan<- prometheus.Metric, logger log.Logger) error {
|
||||
func (ScrapeUser) Scrape(ctx context.Context, instance *instance, ch chan<- prometheus.Metric, logger log.Logger) error {
|
||||
db := instance.getDB()
|
||||
var (
|
||||
userRows *sql.Rows
|
||||
err error
|
||||
|
Reference in New Issue
Block a user