[tor-commits] [snowflake/master] Changed time resolution for metrics collection

cohosh at torproject.org cohosh at torproject.org
Fri Jun 28 21:32:20 UTC 2019


commit 64ce7dff1b38ecda027d67c8ba54d8290755afa0
Author: Cecylia Bocovich <cohosh at torproject.org>
Date:   Tue Jun 11 13:44:59 2019 -0400

    Changed time resolution for metrics collection
    
    Set the resolution of metrics data collection to be every 24 hours
---
 broker/metrics.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/broker/metrics.go b/broker/metrics.go
index f961d1f..4ba762a 100644
--- a/broker/metrics.go
+++ b/broker/metrics.go
@@ -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())
 





More information about the tor-commits mailing list