@@ -47,8 +47,10 @@ const IP_NOT_FOUND_PLACEHOLDER = "NA"
4747const DEFAULT_NUMBER_OF_SERVICES = 6
4848
4949const HEART_BEAT_DURATION = 6 * time .Hour
50+ const ACTIVE_USER_DURATION = 30 * time .Minute
5051
5152// const HEART_BEAT_DURATION = 30 * time.Second
53+ // const ACTIVE_USER_DURATION = 30 * time.Second
5254
5355const RATE_LIMIT_CHECK_DURATION = 1 * time .Minute
5456const RATE_LIMIT_VALUE = 2
@@ -141,6 +143,8 @@ func createTelemetry() {
141143 telemetry .SendEvent (TELEMETRY_EVENT_HEART_BEAT , data )
142144
143145 ticker := time .NewTicker (HEART_BEAT_DURATION )
146+ activeUserTicker := time .NewTicker (ACTIVE_USER_DURATION )
147+
144148 rateLimitTicker := time .NewTicker (RATE_LIMIT_CHECK_DURATION )
145149
146150 go func () {
@@ -154,14 +158,15 @@ func createTelemetry() {
154158 go func () {
155159 for {
156160 select {
157- case <- ticker .C :
158-
161+ case <- activeUserTicker .C :
159162 if (telemetry .activeUser ["traces" ] != 0 ) || (telemetry .activeUser ["metrics" ] != 0 ) || (telemetry .activeUser ["logs" ] != 0 ) {
160163 telemetry .activeUser ["any" ] = 1
161164 }
162165 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" ]})
163166 telemetry .activeUser = map [string ]int8 {"traces" : 0 , "metrics" : 0 , "logs" : 0 , "any" : 0 }
164167
168+ case <- ticker .C :
169+
165170 tagsInfo , _ := telemetry .reader .GetTagsInfoInLastHeartBeatInterval (context .Background ())
166171
167172 if len (tagsInfo .Env ) != 0 {
0 commit comments