Merge pull request #831 from rjnagal/docker

Two small fixes to custom metric collection.
This commit is contained in:
Victor Marmol 2015-07-22 21:34:23 -07:00
commit ca7fd6d40a
2 changed files with 3 additions and 3 deletions

View File

@ -100,7 +100,7 @@ func (collector *GenericCollector) Name() string {
//Returns collected metrics and the next collection time of the collector //Returns collected metrics and the next collection time of the collector
func (collector *GenericCollector) Collect() (time.Time, []v1.Metric, error) { func (collector *GenericCollector) Collect() (time.Time, []v1.Metric, error) {
currentTime := time.Now() currentTime := time.Now()
nextCollectionTime := currentTime.Add(time.Duration(collector.info.minPollingFrequency * time.Second)) nextCollectionTime := currentTime.Add(time.Duration(collector.info.minPollingFrequency))
uri := collector.configFile.Endpoint uri := collector.configFile.Endpoint
response, err := http.Get(uri) response, err := http.Get(uri)

View File

@ -488,8 +488,8 @@ func (c *containerData) updateStats() error {
} }
} }
var customStatsErr error var customStatsErr error
if c.collectorManager != nil { cm := c.collectorManager.(*collector.GenericCollectorManager)
cm := c.collectorManager.(*collector.GenericCollectorManager) if len(cm.Collectors) > 0 {
if cm.NextCollectionTime.Before(time.Now()) { if cm.NextCollectionTime.Before(time.Now()) {
customStats, err := c.updateCustomStats() customStats, err := c.updateCustomStats()
if customStats != nil { if customStats != nil {