Commit 64ce7dff authored by Cecylia Bocovich's avatar Cecylia Bocovich 💬
Browse files

Changed time resolution for metrics collection

Set the resolution of metrics data collection to be every 24 hours
parent cd650fa0
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -13,6 +13,8 @@ var (
	once sync.Once
)

const metricsResolution = 24 * time.Hour

type CountryStats struct {
	counts map[string]int
}
@@ -94,7 +96,7 @@ func NewMetrics(metricsLogger *log.Logger) (*Metrics, error) {

	// Write to log file every hour with updated metrics
	go once.Do(func() {
		heartbeat := time.Tick(time.Hour)
		heartbeat := time.Tick(metricsResolution)
		for range heartbeat {
			metricsLogger.Println("Country stats: ", m.countryStats.Display())