mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-11 22:39:01 +08:00
chore: different ticker interval for active user
This commit is contained in:
parent
0c27d5acbc
commit
215ea8d819
@ -47,8 +47,10 @@ const IP_NOT_FOUND_PLACEHOLDER = "NA"
|
||||
const DEFAULT_NUMBER_OF_SERVICES = 6
|
||||
|
||||
const HEART_BEAT_DURATION = 6 * time.Hour
|
||||
const ACTIVE_USER_DURATION = 30 * time.Minute
|
||||
|
||||
// const HEART_BEAT_DURATION = 30 * time.Second
|
||||
// const ACTIVE_USER_DURATION = 30 * time.Second
|
||||
|
||||
const RATE_LIMIT_CHECK_DURATION = 1 * time.Minute
|
||||
const RATE_LIMIT_VALUE = 2
|
||||
@ -141,6 +143,8 @@ func createTelemetry() {
|
||||
telemetry.SendEvent(TELEMETRY_EVENT_HEART_BEAT, data)
|
||||
|
||||
ticker := time.NewTicker(HEART_BEAT_DURATION)
|
||||
activeUserTicker := time.NewTicker(ACTIVE_USER_DURATION)
|
||||
|
||||
rateLimitTicker := time.NewTicker(RATE_LIMIT_CHECK_DURATION)
|
||||
|
||||
go func() {
|
||||
@ -154,14 +158,15 @@ func createTelemetry() {
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case <-ticker.C:
|
||||
|
||||
case <-activeUserTicker.C:
|
||||
if (telemetry.activeUser["traces"] != 0) || (telemetry.activeUser["metrics"] != 0) || (telemetry.activeUser["logs"] != 0) {
|
||||
telemetry.activeUser["any"] = 1
|
||||
}
|
||||
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"]})
|
||||
telemetry.activeUser = map[string]int8{"traces": 0, "metrics": 0, "logs": 0, "any": 0}
|
||||
|
||||
case <-ticker.C:
|
||||
|
||||
tagsInfo, _ := telemetry.reader.GetTagsInfoInLastHeartBeatInterval(context.Background())
|
||||
|
||||
if len(tagsInfo.Env) != 0 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user