Преглед на файлове

update stat gauges first run to avoid gaps

bergquist преди 8 години
родител
ревизия
dd9d4ecfbe
променени са 1 файла, в които са добавени 3 реда и са изтрити 3 реда
  1. 3 3
      pkg/metrics/metrics.go

+ 3 - 3
pkg/metrics/metrics.go

@@ -260,11 +260,11 @@ func instrumentationLoop(settings *MetricSettings) chan struct{} {
 	}
 }
 
+var metricPublishCounter int64 = 0
+
 func updateTotalStats() {
-	// every interval also publish totals
 	metricPublishCounter++
-	if metricPublishCounter%10 == 0 {
-		// get stats
+	if metricPublishCounter == 1 || metricPublishCounter%10 == 0 {
 		statsQuery := models.GetSystemStatsQuery{}
 		if err := bus.Dispatch(&statsQuery); err != nil {
 			metricsLogger.Error("Failed to get system stats", "error", err)