yanic/database/influxdb/link.go
Julian K f4650213b8 [TASK] add per-link statistics (#57)
ATM: support only influxdb
2017-09-27 13:55:02 +02:00

20 lines
530 B
Go

package influxdb
import (
"time"
"github.com/FreifunkBremen/yanic/runtime"
models "github.com/influxdata/influxdb/models"
)
// 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)
tags.SetString("source.mac", link.SourceMAC)
tags.SetString("target.id", link.TargetID)
tags.SetString("target.mac", link.TargetMAC)
conn.addPoint(MeasurementLink, tags, models.Fields{"tq": float32(link.TQ) / 2.55}, t)
}