Skip to content

Commit 589b9a0

Browse files
authored
Merge pull request #33 from percona/PMM-2576_PMM-2737_fix_prometheus_metric_names
PMM-2576, PMM-2737: Fix prometheus metric names for SHOW GLOBAL VARIABLES.
2 parents ba46974 + c4d7e1f commit 589b9a0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

collector/global_variables.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func (ScrapeGlobalVariables) Scrape(db *sql.DB, ch chan<- prometheus.Metric) err
145145
return err
146146
}
147147

148-
key = strings.ToLower(key)
148+
key = validPrometheusName(key)
149149
if floatVal, ok := parseStatus(val); ok {
150150
help := globalVariablesHelp[key]
151151
if help == "" {
@@ -211,3 +211,9 @@ func parseWsrepProviderOptions(opts string) float64 {
211211

212212
return val
213213
}
214+
215+
func validPrometheusName(s string) string {
216+
s = strings.ToLower(s)
217+
s = strings.Replace(s, ".", "_", -1)
218+
return s
219+
}

0 commit comments

Comments
 (0)