Skip to content

Commit 556a431

Browse files
author
Tomas Haber
committed
Fix for more than one column in definitions in queries.yaml
1 parent 8ae2887 commit 556a431

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

postgres_exporter.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -241,15 +241,14 @@ func addQueries(queriesPath string) (err error) {
241241
queryOverrides[metric] = query
242242

243243
case "metrics":
244+
var metric_map map[string]ColumnMapping
245+
metric_map = make(map[string]ColumnMapping)
246+
244247
for _, c := range value.([]interface{}) {
245248
column := c.(map[interface{}]interface{})
246249

247250
for n, a := range column {
248251
var cmap ColumnMapping
249-
var metric_map map[string]ColumnMapping
250-
251-
metric_map = make(map[string]ColumnMapping)
252-
253252
name := n.(string)
254253

255254
for attr_key, attr_val := range a.(map[interface{}]interface{}) {
@@ -266,12 +265,10 @@ func addQueries(queriesPath string) (err error) {
266265
}
267266

268267
cmap.mapping = nil
269-
270-
metric_map[name] = cmap
271-
272-
metricMaps[metric] = metric_map
268+
metric_map[name] = cmap
273269
}
274270
}
271+
metricMaps[metric] = metric_map
275272
}
276273
}
277274
}

0 commit comments

Comments
 (0)