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", "model/sensorconfig",
"service/probe" "service/probe"
] ]
revision = "2b132edc0887553bf69387a83cbaf8870ca5f710" revision = "7b089c913a281a3286b3c72456e3aab67f402720"
[[projects]] [[projects]]
branch = "master" branch = "master"

View File

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