Skip to content

Commit c4d7e1f

Browse files
committed
PMM-2576, PMM-2737: Fix prometheus metric names for SHOW GLOBAL VARIABLES.
* replace `.` with `_` Signed-off-by: Kamil Dziedzic <[email protected]>
1 parent ba46974 commit c4d7e1f

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)