@@ -46,8 +46,10 @@ const IP_NOT_FOUND_PLACEHOLDER = "NA"
4646const DEFAULT_NUMBER_OF_SERVICES = 6
4747
4848const HEART_BEAT_DURATION = 6 * time .Hour
49+ const ACTIVE_USER_DURATION = 30 * time .Minute
4950
50- // const HEART_BEAT_DURATION = 10 * time.Second
51+ // const HEART_BEAT_DURATION = 30 * time.Second
52+ // const ACTIVE_USER_DURATION = 30 * time.Second
5153
5254const RATE_LIMIT_CHECK_DURATION = 1 * time .Minute
5355const RATE_LIMIT_VALUE = 2
@@ -133,6 +135,8 @@ func createTelemetry() {
133135 telemetry .SendEvent (TELEMETRY_EVENT_HEART_BEAT , data )
134136
135137 ticker := time .NewTicker (HEART_BEAT_DURATION )
138+ activeUserTicker := time .NewTicker (ACTIVE_USER_DURATION )
139+
136140 rateLimitTicker := time .NewTicker (RATE_LIMIT_CHECK_DURATION )
137141
138142 go func () {
@@ -146,14 +150,15 @@ func createTelemetry() {
146150 go func () {
147151 for {
148152 select {
149- case <- ticker .C :
150-
153+ case <- activeUserTicker .C :
151154 if (telemetry .activeUser ["traces" ] != 0 ) || (telemetry .activeUser ["metrics" ] != 0 ) || (telemetry .activeUser ["logs" ] != 0 ) {
152155 telemetry .activeUser ["any" ] = 1
153156 }
154157 telemetry .SendEvent (TELEMETRY_EVENT_ACTIVE_USER , map [string ]interface {}{"traces" : telemetry .activeUser ["traces" ], "metrics" : telemetry .activeUser ["metrics" ], "logs" : telemetry .activeUser ["logs" ], "any" : telemetry .activeUser ["any" ]})
155158 telemetry .activeUser = map [string ]int8 {"traces" : 0 , "metrics" : 0 , "logs" : 0 , "any" : 0 }
156159
160+ case <- ticker .C :
161+
157162 tagsInfo , _ := telemetry .reader .GetTagsInfoInLastHeartBeatInterval (context .Background ())
158163
159164 if len (tagsInfo .Env ) != 0 {
0 commit comments