Add ability to exclude db/bucket tag from influxdb outputs (#6184)

This commit is contained in:
Greg
2019-07-30 15:16:51 -06:00
committed by Daniel Nelson
parent 3f63c14179
commit a1bff8f550
6 changed files with 75 additions and 47 deletions

View File

@@ -94,6 +94,7 @@ type HTTPConfig struct {
ContentEncoding string
Database string
DatabaseTag string
ExcludeDatabaseTag bool
RetentionPolicy string
Consistency string
SkipDatabaseCreation bool
@@ -250,6 +251,10 @@ func (c *httpClient) Write(ctx context.Context, metrics []telegraf.Metric) error
batches[db] = make([]telegraf.Metric, 0)
}
if c.config.ExcludeDatabaseTag {
metric.RemoveTag(c.config.DatabaseTag)
}
batches[db] = append(batches[db], metric)
}