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.

fix: set userId as distinctId if failed to fetch IP

Ankit Nayan10faa6f42b00
diff --git a/pkg/query-service/telemetry/telemetry.go b/pkg/query-service/telemetry/telemetry.go
index 5de8392e0c..8a60be19da 100644
--- a/pkg/query-service/telemetry/telemetry.go
+++ b/pkg/query-service/telemetry/telemetry.go
@@ -22,6 +22,7 @@ const (
)
const api_key = "4Gmoa4ixJAUHx2BpJxsjwA1bEfnwEeRz"
+const IP_NOT_FOUND_PLACEHOLDER = "NA"
var telemetry *Telemetry
var once sync.Once
@@ -59,7 +60,7 @@ func createTelemetry() {
// Get preferred outbound ip of this machine
func getOutboundIP() string {
- ip := []byte("NA")
+ ip := []byte(IP_NOT_FOUND_PLACEHOLDER)
resp, err := http.Get("https://api.ipify.org?format=text")
if err != nil {
@@ -116,7 +117,7 @@ func (a *Telemetry) SendEvent(event string, data map[string]interface{}) {
}
userId := a.ipAddress
- if a.isTelemetryAnonymous() {
+ if a.isTelemetryAnonymous() || userId == IP_NOT_FOUND_PLACEHOLDER {
userId = a.GetDistinctId()
}