Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

chore: segment oss (#5910)

Vishal Sharma573d369d4b9e
diff --git a/pkg/query-service/constants/constants.go b/pkg/query-service/constants/constants.go
index 02211008c1..70eda959dc 100644
--- a/pkg/query-service/constants/constants.go
+++ b/pkg/query-service/constants/constants.go
@@ -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 {
diff --git a/pkg/query-service/telemetry/telemetry.go b/pkg/query-service/telemetry/telemetry.go
index 88f3a09542..7f282ea3f9 100644
--- a/pkg/query-service/telemetry/telemetry.go
+++ b/pkg/query-service/telemetry/telemetry.go
@@ -204,11 +204,19 @@ func createTelemetry() {
return
}
- telemetry = &Telemetry{
- ossOperator: analytics.New(api_key),
- ipAddress: getOutboundIP(),
- rateLimits: make(map[string]int8),
- activeUser: make(map[string]int8),
+ 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,16 +492,18 @@ func (a *Telemetry) IdentifyUser(user *model.User) {
})
}
- a.ossOperator.Enqueue(analytics.Identify{
- UserId: a.ipAddress,
- Traits: analytics.NewTraits().SetName(user.Name).SetEmail(user.Email).Set("ip", a.ipAddress),
- })
- // Updating a groups properties
- a.ossOperator.Enqueue(analytics.Group{
- UserId: a.ipAddress,
- GroupId: a.getCompanyDomain(),
- Traits: analytics.NewTraits().Set("company_domain", a.getCompanyDomain()),
- })
+ 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),
+ })
+ // Updating a groups properties
+ a.ossOperator.Enqueue(analytics.Group{
+ UserId: a.ipAddress,
+ GroupId: a.getCompanyDomain(),
+ Traits: analytics.NewTraits().Set("company_domain", a.getCompanyDomain()),
+ })
+ }
}
func (a *Telemetry) SetUserEmail(email string) {