This commit is contained in:
crusader 2018-03-27 18:46:46 +09:00
parent 35835eb736
commit e7a2c3714e
2 changed files with 13 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import (
cda "git.loafle.net/commons_go/di/annotation"
cdr "git.loafle.net/commons_go/di/registry"
"git.loafle.net/commons_go/logging"
oocmci "git.loafle.net/overflow/overflow_commons_go/modules/commons/interfaces"
"git.loafle.net/overflow/overflow_probe_container/crawler"
)
@ -47,10 +48,13 @@ func (cs *CrawlerService) GetData(sensorConfigID string) (map[string]string, err
return nil, fmt.Errorf("There is no crawler[%s] for id[%s]", _crawlerName, sensorConfigID)
}
logging.Logger().Debugf("GetData invoked with sensor config[%s]", sensorConfigID)
result, err := _crawler.Get(sensorConfig)
if nil != err {
return nil, fmt.Errorf("Failed to get data from crawler[%s] for id[%s] %v", _crawlerName, sensorConfigID, err)
}
logging.Logger().Debugf("GetData success config[%v]", result)
return result, nil
}

View File

@ -7,6 +7,7 @@ import (
cda "git.loafle.net/commons_go/di/annotation"
cdr "git.loafle.net/commons_go/di/registry"
"git.loafle.net/commons_go/logging"
oocmci "git.loafle.net/overflow/overflow_commons_go/modules/commons/interfaces"
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
)
@ -42,6 +43,8 @@ func (scs *SensorConfigService) Init(sensorConfigs []*sensorConfigM.SensorConfig
scs.sensorConfigs[sensorConfig.ID.String()] = sensorConfig
}
logging.Logger().Debugf("Sensor configs[%d] were added", len(sensorConfigs))
return nil
}
func (scs *SensorConfigService) AddConfig(sensorConfig *sensorConfigM.SensorConfig) error {
@ -54,6 +57,9 @@ func (scs *SensorConfigService) AddConfig(sensorConfig *sensorConfigM.SensorConf
return fmt.Errorf("Sensor config[%s] is exist already", sensorConfigID)
}
scs.sensorConfigs[sensorConfigID] = sensorConfig
logging.Logger().Debugf("Sensor config[%d] was added", sensorConfigID)
return nil
}
func (scs *SensorConfigService) UpdateConfig(sensorConfig *sensorConfigM.SensorConfig) error {
@ -68,6 +74,8 @@ func (scs *SensorConfigService) UpdateConfig(sensorConfig *sensorConfigM.SensorC
delete(scs.sensorConfigs, sensorConfigID)
scs.sensorConfigs[sensorConfigID] = sensorConfig
logging.Logger().Debugf("Sensor config[%d] was updated", sensorConfigID)
return nil
}
func (scs *SensorConfigService) RemoveConfig(sensorConfigID string) error {
@ -76,5 +84,6 @@ func (scs *SensorConfigService) RemoveConfig(sensorConfigID string) error {
}
delete(scs.sensorConfigs, sensorConfigID)
logging.Logger().Debugf("Sensor config[%d] was removed", sensorConfigID)
return nil
}