You've already forked mysqld_exporter
mirror of
https://github.com/prometheus/mysqld_exporter.git
synced 2025-07-31 17:44:21 +03:00
compatible with mysql<=5.7
Signed-off-by: hateeyan <hateeyan@gmail.com>
This commit is contained in:
@ -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,
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -69,6 +69,7 @@ func TestScrapeGlobalVariables(t *testing.T) {
|
||||
{labels: labelMap{"innodb_version": "5.6.30-76.3", "version": "5.6.30-76.3-56", "version_comment": "Percona XtraDB Cluster..."}, value: 1, metricType: dto.MetricType_GAUGE},
|
||||
{labels: labelMap{"wsrep_cluster_name": "supercluster"}, value: 1, metricType: dto.MetricType_GAUGE},
|
||||
{labels: labelMap{}, value: 134217728, metricType: dto.MetricType_GAUGE},
|
||||
{labels: labelMap{"level": "REPEATABLE-READ"}, value: 1, metricType: dto.MetricType_GAUGE},
|
||||
}
|
||||
convey.Convey("Metrics comparison", t, func() {
|
||||
for _, expect := range counterExpected {
|
||||
|
Reference in New Issue
Block a user