2017-09-27 11:55:02 +00:00
|
|
|
package influxdb
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/FreifunkBremen/yanic/runtime"
|
2019-01-15 19:19:55 +00:00
|
|
|
models "github.com/influxdata/influxdb1-client/models"
|
2017-09-27 11:55:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// InsertLink adds a link data point
|
|
|
|
func (conn *Connection) InsertLink(link *runtime.Link, t time.Time) {
|
|
|
|
tags := models.Tags{}
|
|
|
|
tags.SetString("source.id", link.SourceID)
|
2017-12-05 22:17:49 +00:00
|
|
|
tags.SetString("source.addr", link.SourceAddress)
|
2017-09-27 11:55:02 +00:00
|
|
|
tags.SetString("target.id", link.TargetID)
|
2017-12-05 22:17:49 +00:00
|
|
|
tags.SetString("target.addr", link.TargetAddress)
|
2017-09-27 11:55:02 +00:00
|
|
|
|
2017-12-05 22:17:49 +00:00
|
|
|
conn.addPoint(MeasurementLink, tags, models.Fields{"tq": link.TQ * 100}, t)
|
2017-09-27 11:55:02 +00:00
|
|
|
}
|