mirror of
https://github.com/prometheus-community/postgres_exporter
synced 2025-05-16 23:08:45 +00:00
Fix issue #174
Postgres can emit 32MB and 64MB units which were previously unhandled. Handle them.
This commit is contained in:
parent
771eb94ea8
commit
d5caaf5a4d
@ -96,7 +96,7 @@ func (s *pgSetting) normaliseUnit() (val float64, unit string, err error) {
|
|||||||
return
|
return
|
||||||
case "ms", "s", "min", "h", "d":
|
case "ms", "s", "min", "h", "d":
|
||||||
unit = "seconds"
|
unit = "seconds"
|
||||||
case "kB", "MB", "GB", "TB", "8kB", "16kB", "32kB", "16MB":
|
case "kB", "MB", "GB", "TB", "8kB", "16kB", "32kB", "16MB", "32MB", "64MB":
|
||||||
unit = "bytes"
|
unit = "bytes"
|
||||||
default:
|
default:
|
||||||
err = fmt.Errorf("Unknown unit for runtime variable: %q", s.unit)
|
err = fmt.Errorf("Unknown unit for runtime variable: %q", s.unit)
|
||||||
@ -134,6 +134,12 @@ func (s *pgSetting) normaliseUnit() (val float64, unit string, err error) {
|
|||||||
case "16MB":
|
case "16MB":
|
||||||
val *= math.Pow(2, 24)
|
val *= math.Pow(2, 24)
|
||||||
}
|
}
|
||||||
|
case "32MB":
|
||||||
|
val *= math.Pow(2, 25)
|
||||||
|
}
|
||||||
|
case "64MB":
|
||||||
|
val *= math.Pow(2, 26)
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user