Skip to content

Commit

Permalink
Merge d32a348 into d20277a
Browse files Browse the repository at this point in the history
  • Loading branch information
kb-light committed Apr 21, 2017
2 parents d20277a + d32a348 commit b437bfd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config_example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ address = "http://localhost:8086"
database = "ffhb"
username = ""
password = ""
# tag the data with an optional job tag
job = "ffhb01"

[[database.connection.logging]]
enable = false
Expand Down
6 changes: 6 additions & 0 deletions database/influxdb/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ func (c Config) Username() string {
func (c Config) Password() string {
return c["password"].(string)
}
func (c Config) Job() string {
return c["job"].(string)
}

func init() {
database.RegisterAdapter("influxdb", Connect)
Expand Down Expand Up @@ -79,6 +82,9 @@ func Connect(configuration interface{}) (database.Connection, error) {
}

func (conn *Connection) addPoint(name string, tags models.Tags, fields models.Fields, t ...time.Time) {
if job := conn.config.Job(); job != "" {
tags.SetString("job", job)
}
point, err := client.NewPoint(name, tags.Map(), fields, t...)
if err != nil {
panic(err)
Expand Down

0 comments on commit b437bfd

Please sign in to comment.