Skip to content

Commit

Permalink
influxdb output: write consistency parameter
Browse files Browse the repository at this point in the history
closes #1249
  • Loading branch information
sparrc committed May 24, 2016
1 parent 52d5b19 commit 6970a5d
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions plugins/outputs/influxdb/influxdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ import (

type InfluxDB struct {
// URL is only for backwards compatability
URL string
URLs []string `toml:"urls"`
Username string
Password string
Database string
UserAgent string
Precision string
RetentionPolicy string
Timeout internal.Duration
UDPPayload int `toml:"udp_payload"`
URL string
URLs []string `toml:"urls"`
Username string
Password string
Database string
UserAgent string
Precision string
RetentionPolicy string
WriteConsistency string
Timeout internal.Duration
UDPPayload int `toml:"udp_payload"`

// Path to CA file
SSLCA string `toml:"ssl_ca"`
Expand All @@ -49,12 +50,15 @@ var sampleConfig = `
urls = ["http://localhost:8086"] # required
## The target database for metrics (telegraf will create it if not exists).
database = "telegraf" # required
## Retention policy to write to.
retention_policy = "default"
## Precision of writes, valid values are "ns", "us" (or "µs"), "ms", "s", "m", "h".
## note: using "s" precision greatly improves InfluxDB compression.
precision = "s"
## Retention policy to write to.
retention_policy = "default"
## Write consistency (clusters only), can be: "any", "one", "quorom", "all"
write_consistency = "any"
## Write timeout (for the InfluxDB client), formatted as a string.
## If not provided, will default to 5s. 0s means no timeout (not recommended).
timeout = "5s"
Expand Down Expand Up @@ -179,9 +183,10 @@ func (i *InfluxDB) Write(metrics []telegraf.Metric) error {
}
}
bp, err := client.NewBatchPoints(client.BatchPointsConfig{
Database: i.Database,
Precision: i.Precision,
RetentionPolicy: i.RetentionPolicy,
Database: i.Database,
Precision: i.Precision,
RetentionPolicy: i.RetentionPolicy,
WriteConsistency: i.WriteConsistency,
})
if err != nil {
return err
Expand Down

0 comments on commit 6970a5d

Please sign in to comment.