From d43aeed4ccd5f89fa01c188b1a7a7e1666544117 Mon Sep 17 00:00:00 2001 From: Thomas Menard Date: Mon, 7 Mar 2016 11:25:26 +0100 Subject: [PATCH] Postgresql_extensible, ran fmt --- .../postgresql_extensible/postgresql_extensible.go | 14 +++++++------- .../postgresql_extensible_test.go | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/plugins/inputs/postgresql_extensible/postgresql_extensible.go b/plugins/inputs/postgresql_extensible/postgresql_extensible.go index a72746891..bf060506d 100644 --- a/plugins/inputs/postgresql_extensible/postgresql_extensible.go +++ b/plugins/inputs/postgresql_extensible/postgresql_extensible.go @@ -18,7 +18,7 @@ type Postgresql struct { OrderedColumns []string AllColumns []string AdditionalTags []string - Query []struct { + Query []struct { Sqlquery string Version int Withdbname bool @@ -27,11 +27,11 @@ type Postgresql struct { } type query []struct { - Sqlquery string - Version int - Withdbname bool - Tagvalue string -} + Sqlquery string + Version int + Withdbname bool + Tagvalue string +} var ignoredColumns = map[string]bool{"datid": true, "datname": true, "stats_reset": true} @@ -122,7 +122,7 @@ func (p *Postgresql) Gather(acc telegraf.Accumulator) error { for i := range p.Query { sql_query = p.Query[i].Sqlquery tag_value = p.Query[i].Tagvalue - + if p.Query[i].Withdbname { if len(p.Databases) != 0 { query_addon = fmt.Sprintf(` IN ('%s')`, diff --git a/plugins/inputs/postgresql_extensible/postgresql_extensible_test.go b/plugins/inputs/postgresql_extensible/postgresql_extensible_test.go index f4e6d9915..7fd907102 100644 --- a/plugins/inputs/postgresql_extensible/postgresql_extensible_test.go +++ b/plugins/inputs/postgresql_extensible/postgresql_extensible_test.go @@ -18,12 +18,12 @@ func TestPostgresqlGeneratesMetrics(t *testing.T) { Address: fmt.Sprintf("host=%s user=postgres sslmode=disable", testutil.GetLocalHost()), Databases: []string{"postgres"}, - Query: query{ - {Sqlquery: "select * from pg_stat_database", - Version: 901, + Query: query{ + {Sqlquery: "select * from pg_stat_database", + Version: 901, Withdbname: false, - Tagvalue: ""}, - }, + Tagvalue: ""}, + }, } var acc testutil.Accumulator err := p.Gather(&acc)