This commit is contained in:
geek 2018-07-09 20:04:27 +09:00
parent 99dfb7ad78
commit b1a8b49044
2 changed files with 9 additions and 6 deletions

2
Gopkg.lock generated
View File

@ -77,7 +77,7 @@
"model/sensorconfig",
"service/probe"
]
revision = "2b132edc0887553bf69387a83cbaf8870ca5f710"
revision = "7b089c913a281a3286b3c72456e3aab67f402720"
[[projects]]
branch = "master"

View File

@ -112,17 +112,20 @@ func (s *CollectorService) removeSchedule(sensorID string) {
func (s *CollectorService) collectTask(sensorConfig *ocmsc.SensorConfig) {
logging.Logger().Debugf("CollectorService.collectTask for sensor config id[%s] of crawler[%s]", sensorConfig.SensorID, sensorConfig.Crawler.MetaCrawlerKey)
m := &ocmd.Metric{
SensorID: sensorConfig.SensorID.String(),
StartDate: occu.NowPtr(),
}
result, err := s.CrawlerService.Get(sensorConfig.SensorID.String())
if nil != err {
logging.Logger().Errorf("Cannot get data from crawler[%s] %v", sensorConfig.Crawler.MetaCrawlerKey, err)
return
}
m := &ocmd.Metric{
SensorID: sensorConfig.SensorID.String(),
Data: result,
StartDate: occu.NowPtr(),
}
m.Data = result
m.EndDate = occu.NowPtr()
m.Success = true
if err := s.ProbeService.Send("MetricService.Send", m); nil != err {
logging.Logger().Errorf("Cannot send data from config id[%s] of crawler[%s] %v", sensorConfig.SensorID, sensorConfig.Crawler.MetaCrawlerKey, err)