mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-11 21:09:09 +08:00
chore: reduce events
This commit is contained in:
parent
93b6749920
commit
a906f94b8a
@ -11,3 +11,18 @@ func IgnoredPaths() map[string]struct{} {
|
||||
|
||||
return ignoredPaths
|
||||
}
|
||||
|
||||
func ignoreEvents(event string, attributes map[string]interface{}) bool {
|
||||
|
||||
if event == TELEMETRY_EVENT_ACTIVE_USER || event == TELEMETRY_EVENT_ACTIVE_USER_PH {
|
||||
for attr_key, attr_val := range attributes {
|
||||
|
||||
if attr_key == "any" && attr_val.(int8) == 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
@ -46,13 +46,14 @@ 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
|
||||
const RATE_LIMIT_VALUE = 1
|
||||
|
||||
// const RATE_LIMIT_CHECK_DURATION = 20 * time.Second
|
||||
// const RATE_LIMIT_VALUE = 5
|
||||
@ -301,6 +302,11 @@ func (a *Telemetry) SendEvent(event string, data map[string]interface{}, opts ..
|
||||
return
|
||||
}
|
||||
|
||||
// drop events with properties matching
|
||||
if ignoreEvents(event, data) {
|
||||
return
|
||||
}
|
||||
|
||||
if rateLimitFlag {
|
||||
if a.rateLimits[event] < RATE_LIMIT_VALUE {
|
||||
a.rateLimits[event] += 1
|
||||
|
Loading…
x
Reference in New Issue
Block a user