Skip to content

Commit c0bd57f

Browse files
Eric-Tyrrell22Deryugin, Nikolay
authored and
Deryugin, Nikolay
committed
Adds 1kB and 2kB units (prometheus-community#915)
Signed-off-by: Eric tyrrell <eric.tyrrell18+github@gmail.com>
1 parent b3e1101 commit c0bd57f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmd/postgres_exporter/pg_setting.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func (s *pgSetting) normaliseUnit() (val float64, unit string, err error) {
129129
return
130130
case "ms", "s", "min", "h", "d":
131131
unit = "seconds"
132-
case "B", "kB", "MB", "GB", "TB", "4kB", "8kB", "16kB", "32kB", "64kB", "16MB", "32MB", "64MB":
132+
case "B", "kB", "MB", "GB", "TB", "1kB", "2kB", "4kB", "8kB", "16kB", "32kB", "64kB", "16MB", "32MB", "64MB":
133133
unit = "bytes"
134134
default:
135135
err = fmt.Errorf("Unknown unit for runtime variable: %q", s.unit)
@@ -158,6 +158,10 @@ func (s *pgSetting) normaliseUnit() (val float64, unit string, err error) {
158158
val *= math.Pow(2, 30)
159159
case "TB":
160160
val *= math.Pow(2, 40)
161+
case "1kB":
162+
val *= math.Pow(2, 10)
163+
case "2kB":
164+
val *= math.Pow(2, 11)
161165
case "4kB":
162166
val *= math.Pow(2, 12)
163167
case "8kB":

0 commit comments

Comments
 (0)