mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 05:25:57 +08:00
chore: segment oss (#5910)
Co-authored-by: Prashant Shahi <prashant@signoz.io>
This commit is contained in:
parent
3c151e3adb
commit
573d369d4b
@ -25,6 +25,11 @@ var ConfigSignozIo = "https://config.signoz.io/api/v1"
|
||||
|
||||
var DEFAULT_TELEMETRY_ANONYMOUS = false
|
||||
|
||||
func IsOSSTelemetryEnabled() bool {
|
||||
ossSegmentKey := GetOrDefaultEnv("OSS_TELEMETRY_ENABLED", "true")
|
||||
return ossSegmentKey == "true"
|
||||
}
|
||||
|
||||
const MaxAllowedPointsInTimeSeries = 300
|
||||
|
||||
func IsTelemetryEnabled() bool {
|
||||
|
@ -204,12 +204,20 @@ func createTelemetry() {
|
||||
return
|
||||
}
|
||||
|
||||
if constants.IsOSSTelemetryEnabled() {
|
||||
telemetry = &Telemetry{
|
||||
ossOperator: analytics.New(api_key),
|
||||
ipAddress: getOutboundIP(),
|
||||
rateLimits: make(map[string]int8),
|
||||
activeUser: make(map[string]int8),
|
||||
}
|
||||
} else {
|
||||
telemetry = &Telemetry{
|
||||
ipAddress: getOutboundIP(),
|
||||
rateLimits: make(map[string]int8),
|
||||
activeUser: make(map[string]int8),
|
||||
}
|
||||
}
|
||||
telemetry.minRandInt = 0
|
||||
telemetry.maxRandInt = int(1 / DEFAULT_SAMPLING)
|
||||
|
||||
@ -484,6 +492,7 @@ func (a *Telemetry) IdentifyUser(user *model.User) {
|
||||
})
|
||||
}
|
||||
|
||||
if a.ossOperator != nil {
|
||||
a.ossOperator.Enqueue(analytics.Identify{
|
||||
UserId: a.ipAddress,
|
||||
Traits: analytics.NewTraits().SetName(user.Name).SetEmail(user.Email).Set("ip", a.ipAddress),
|
||||
@ -495,6 +504,7 @@ func (a *Telemetry) IdentifyUser(user *model.User) {
|
||||
Traits: analytics.NewTraits().Set("company_domain", a.getCompanyDomain()),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func (a *Telemetry) SetUserEmail(email string) {
|
||||
a.userEmail = email
|
||||
|
Loading…
x
Reference in New Issue
Block a user