postgresql_extensible: fix nil field values

nil field values would break the output influxdb line procotol.
Skip them from the output.
This commit is contained in:
Mika Eloranta 2016-04-25 16:27:23 +03:00 committed by Cameron Sparr
parent ce7d852d22
commit 1a7340bb02
1 changed files with 5 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import (
"bytes" "bytes"
"database/sql" "database/sql"
"fmt" "fmt"
"log"
"regexp" "regexp"
"strings" "strings"
@ -259,9 +260,11 @@ func (p *Postgresql) accRow(meas_name string, row scanner, acc telegraf.Accumula
var isATag int var isATag int
fields := make(map[string]interface{}) fields := make(map[string]interface{})
for col, val := range columnMap { for col, val := range columnMap {
if acc.Debug() {
log.Printf("postgresql_extensible: column: %s = %T: %s\n", col, *val, *val)
}
_, ignore := ignoredColumns[col] _, ignore := ignoredColumns[col]
//if !ignore && *val != "" { if !ignore && *val != nil {
if !ignore {
isATag = 0 isATag = 0
for tag := range p.AdditionalTags { for tag := range p.AdditionalTags {
if col == p.AdditionalTags[tag] { if col == p.AdditionalTags[tag] {