Changed time resolution for metrics collection

Set the resolution of metrics data collection to be every 24 hours
This commit is contained in:
Cecylia Bocovich 2019-06-11 13:44:59 -04:00
parent cd650fa009
commit 64ce7dff1b

View file

@ -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())