[TASK] add autoupdater to graphite database

This commit is contained in:
Julian Labus 2017-11-30 12:45:28 +01:00 committed by Geno
parent 7324567f91
commit 62bb21102f
2 changed files with 8 additions and 4 deletions

View File

@ -13,6 +13,7 @@ const (
MeasurementGlobal = "global" // Measurement for summarized global statistics MeasurementGlobal = "global" // Measurement for summarized global statistics
CounterMeasurementFirmware = "firmware" // Measurement for firmware statistics CounterMeasurementFirmware = "firmware" // Measurement for firmware statistics
CounterMeasurementModel = "model" // Measurement for model statistics CounterMeasurementModel = "model" // Measurement for model statistics
CounterMeasurementAutoupdater = "autoupdater" // Measurement for autoupdater
) )
type Connection struct { type Connection struct {

View File

@ -11,16 +11,19 @@ func (c *Connection) InsertGlobals(stats *runtime.GlobalStats, time time.Time, s
measurementGlobal := MeasurementGlobal measurementGlobal := MeasurementGlobal
counterMeasurementModel := CounterMeasurementModel counterMeasurementModel := CounterMeasurementModel
counterMeasurementFirmware := CounterMeasurementFirmware counterMeasurementFirmware := CounterMeasurementFirmware
counterMeasurementAutoupdater := CounterMeasurementAutoupdater
if site != runtime.GLOBAL_SITE { if site != runtime.GLOBAL_SITE {
measurementGlobal += "_" + site measurementGlobal += "_" + site
counterMeasurementModel += "_" + site counterMeasurementModel += "_" + site
counterMeasurementFirmware += "_" + site counterMeasurementFirmware += "_" + site
counterMeasurementAutoupdater += "_" + site
} }
c.addPoint(GlobalStatsFields(measurementGlobal, stats)) c.addPoint(GlobalStatsFields(measurementGlobal, stats))
c.addCounterMap(counterMeasurementModel, stats.Models, time) c.addCounterMap(counterMeasurementModel, stats.Models, time)
c.addCounterMap(counterMeasurementFirmware, stats.Firmwares, time) c.addCounterMap(counterMeasurementFirmware, stats.Firmwares, time)
c.addCounterMap(counterMeasurementAutoupdater, stats.Autoupdater, time)
} }
func GlobalStatsFields(name string, stats *runtime.GlobalStats) []graphigo.Metric { func GlobalStatsFields(name string, stats *runtime.GlobalStats) []graphigo.Metric {