1
0
mirror of https://github.com/prometheus/mysqld_exporter.git synced 2025-07-30 06:43:05 +03:00

compatible with mysql<=5.7

Signed-off-by: hateeyan <hateeyan@gmail.com>
This commit is contained in:
hateeyan
2021-12-21 09:37:29 +08:00
parent 733987b514
commit 55df5341e3
2 changed files with 8 additions and 2 deletions

View File

@ -153,6 +153,7 @@ func (ScrapeGlobalVariables) Scrape(ctx context.Context, db *sql.DB, ch chan<- p
"version_comment": "",
"wsrep_cluster_name": "",
"wsrep_provider_options": "",
"tx_isolation": "",
"transaction_isolation": "",
}
@ -206,12 +207,16 @@ func (ScrapeGlobalVariables) Scrape(ctx context.Context, db *sql.DB, ch chan<- p
}
// mysql_transaction_isolation metric.
if textItems["transaction_isolation"] != "" {
if textItems["transaction_isolation"] != "" || textItems["tx_isolation"] != "" {
level := textItems["transaction_isolation"]
if level == "" {
level = textItems["tx_isolation"]
}
ch <- prometheus.MustNewConstMetric(
prometheus.NewDesc(prometheus.BuildFQName(namespace, "transaction", "isolation"), "MySQL transaction isolation.",
[]string{"level"}, nil),
prometheus.GaugeValue,
1, textItems["transaction_isolation"],
1, level,
)
}