collector
This commit is contained in:
parent
f205c2e550
commit
c75555a71c
38
collector.go
38
collector.go
|
@ -63,29 +63,29 @@ func (c *Collector) stop() {
|
|||
}
|
||||
|
||||
func (c *Collector) collect(id string) {
|
||||
go func() {
|
||||
conf := c.cm.GetSensorById(id)
|
||||
log.Printf("COLLECT %s - [ID: %s] [Crawler : %s]", time.Now(), conf.Id, conf.Crawler.Name)
|
||||
conn, err := crm.GetInstance().GetClient(conf.Crawler.Container)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
conf := c.cm.GetSensorById(id)
|
||||
log.Printf("COLLECT %s - [ID: %s] [Crawler : %s]", time.Now(), conf.Id, conf.Crawler.Name)
|
||||
conn, err := crm.GetInstance().GetClient(conf.Crawler.Container)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
defer conn.Close()
|
||||
dc := grpc.NewDataClient(conn)
|
||||
in := &grpc.Input{}
|
||||
|
||||
dc := grpc.NewDataClient(conn)
|
||||
in := &grpc.Input{}
|
||||
in.Id = id
|
||||
in.Name = grpc.Crawlers(grpc.Crawlers_value[conf.Crawler.Name])
|
||||
|
||||
in.Id = id
|
||||
in.Name = grpc.Crawlers(grpc.Crawlers_value[conf.Crawler.Name])
|
||||
|
||||
out, err := dc.Get(context.Background(), in)
|
||||
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
log.Println("collector get result : ", out)
|
||||
c.dataCh <- out
|
||||
out, err := dc.Get(context.Background(), in)
|
||||
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
log.Println("collector get result : ", out)
|
||||
c.dataCh <- out
|
||||
}()
|
||||
}
|
||||
|
||||
func (c *Collector) addSensor(sensorId string) error {
|
||||
|
|
Loading…
Reference in New Issue
Block a user