Fix errors

This commit is contained in:
Malte Blättermann 2017-04-19 23:17:52 +02:00 committed by Martin Geno
parent fb529130e9
commit a4687f52b1
No known key found for this signature in database
GPG Key ID: F0D39A37E925E941
1 changed files with 4 additions and 6 deletions

View File

@ -9,14 +9,13 @@ import (
"log"
"time"
"context"
"github.com/FreifunkBremen/yanic/database"
"github.com/FreifunkBremen/yanic/runtime"
"gopkg.in/olivere/elastic.v5"
"context"
)
type Connection struct {
@ -63,9 +62,9 @@ func Connect(configuration interface{}) (database.Connection, error) {
}
func (conn *Connection) InsertNode(node *runtime.Node) {
log("InsertNode: [", node.Statistics.NodeID, "] clients: ", node.Statistics.Clients.Total)
log.Print("InsertNode: [", node.Statistics.NodeID, "] clients: ", node.Statistics.Clients.Total)
_, err = conn.client.Index()
_, err := conn.client.Index().
Index("ffhb").
Type("node").
BodyJson(node).
@ -80,13 +79,12 @@ func (conn *Connection) InsertNode(node *runtime.Node) {
}
}
func (conn *Connection) InsertGlobals(stats *runtime.GlobalStats, time time.Time) {
log.Print("InsertGlobals: [", time.String(), "] nodes: ", stats.Nodes, ", clients: ", stats.Clients, " models: ", len(stats.Models))
_, err = conn.client.Index()
_, err := conn.client.Index().
Index("ffhb").
Type("globals").
BodyJson(stats).