mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Changed time resolution for metrics collection
Set the resolution of metrics data collection to be every 24 hours
This commit is contained in:
parent
cd650fa009
commit
64ce7dff1b
1 changed files with 3 additions and 1 deletions
|
@ -13,6 +13,8 @@ var (
|
||||||
once sync.Once
|
once sync.Once
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const metricsResolution = 24 * time.Hour
|
||||||
|
|
||||||
type CountryStats struct {
|
type CountryStats struct {
|
||||||
counts map[string]int
|
counts map[string]int
|
||||||
}
|
}
|
||||||
|
@ -94,7 +96,7 @@ func NewMetrics(metricsLogger *log.Logger) (*Metrics, error) {
|
||||||
|
|
||||||
// Write to log file every hour with updated metrics
|
// Write to log file every hour with updated metrics
|
||||||
go once.Do(func() {
|
go once.Do(func() {
|
||||||
heartbeat := time.Tick(time.Hour)
|
heartbeat := time.Tick(metricsResolution)
|
||||||
for range heartbeat {
|
for range heartbeat {
|
||||||
metricsLogger.Println("Country stats: ", m.countryStats.Display())
|
metricsLogger.Println("Country stats: ", m.countryStats.Display())
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue