Skip to content

Commit

Permalink
Add connection timeout configuration for InfluxDB.
Browse files Browse the repository at this point in the history
  • Loading branch information
brocaar committed Jul 10, 2015
1 parent c4e5e74 commit 6ad3726
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func (agent *Agent) Connect() error {
Username: config.Username,
Password: config.Password,
UserAgent: config.UserAgent,
Timeout: config.Timeout * time.Second,
})

if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type Config struct {
Password string
Database string
UserAgent string
Timeout time.Duration
Tags map[string]string

agent *ast.Table
Expand Down Expand Up @@ -243,6 +244,10 @@ url = "http://localhost:8086" # required.
# The target database for metrics. This database must already exist
database = "telegraf" # required.
# Timeout in seconds (for the connection with InfluxDB).
# If not provided, will default to 0 (no timeout)
# timeout = 5
# username = "telegraf"
# password = "metricsmetricsmetricsmetrics"
Expand Down

0 comments on commit 6ad3726

Please sign in to comment.