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.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
chore: only log telemetry query for explorer, rule and dashboard pages (#8464)
Vishal Sharmaba2ed3ad220a
diff --git a/pkg/query-service/app/http_handler.go b/pkg/query-service/app/http_handler.goindex ff5144250e..0e0c9e0369 100644--- a/pkg/query-service/app/http_handler.go+++ b/pkg/query-service/app/http_handler.go@@ -4527,41 +4527,36 @@ func (aH *APIHandler) sendQueryResultEvents(r *http.Request, result []*v3.Result}properties := queryInfoResult.ToMap()-- // Check if result is empty or has no data- if len(result) == 0 {- aH.Signoz.Analytics.TrackUser(r.Context(), claims.OrgID, claims.UserID, "Telemetry Query Returned Empty", properties)- return- }-- // Check if first result has no series data- if len(result[0].Series) == 0 {- // Check if first result has no list data- if len(result[0].List) == 0 {- // Check if first result has no table data- if result[0].Table == nil {- aH.Signoz.Analytics.TrackUser(r.Context(), claims.OrgID, claims.UserID, "Telemetry Query Returned Empty", properties)- return- }-- if len(result[0].Table.Rows) == 0 {- aH.Signoz.Analytics.TrackUser(r.Context(), claims.OrgID, claims.UserID, "Telemetry Query Returned Empty", properties)- return- }- }- }-referrer := r.Header.Get("Referer")if referrer == "" {- aH.Signoz.Analytics.TrackUser(r.Context(), claims.OrgID, claims.UserID, "Telemetry Query Returned Results", properties)return}properties["referrer"] = referrer- if matched, _ := regexp.MatchString(`/dashboard/[a-zA-Z0-9\-]+/(new|edit)(?:\?.*)?$`, referrer); matched {+ logsExplorerMatched, _ := regexp.MatchString(`/logs/logs-explorer(?:\?.*)?$`, referrer)+ traceExplorerMatched, _ := regexp.MatchString(`/traces-explorer(?:\?.*)?$`, referrer)+ metricsExplorerMatched, _ := regexp.MatchString(`/metrics-explorer/explorer(?:\?.*)?$`, referrer)+ dashboardMatched, _ := regexp.MatchString(`/dashboard/[a-zA-Z0-9\-]+/(new|edit)(?:\?.*)?$`, referrer)+ alertMatched, _ := regexp.MatchString(`/alerts/(new|edit)(?:\?.*)?$`, referrer)++ switch {+ case dashboardMatched:+ properties["module_name"] = "dashboard"+ case alertMatched:+ properties["module_name"] = "rule"+ case metricsExplorerMatched:+ properties["module_name"] = "metrics-explorer"+ case logsExplorerMatched:+ properties["module_name"] = "logs-explorer"+ case traceExplorerMatched:+ properties["module_name"] = "traces-explorer"+ default:+ return+ }+ if dashboardMatched {if dashboardIDRegex, err := regexp.Compile(`/dashboard/([a-f0-9\-]+)/`); err == nil {if matches := dashboardIDRegex.FindStringSubmatch(referrer); len(matches) > 1 {properties["dashboard_id"] = matches[1]@@ -4573,25 +4568,39 @@ func (aH *APIHandler) sendQueryResultEvents(r *http.Request, result []*v3.Resultproperties["widget_id"] = matches[1]}}-- properties["module_name"] = "dashboard"- aH.Signoz.Analytics.TrackUser(r.Context(), claims.OrgID, claims.UserID, "Telemetry Query Returned Results", properties)- return}- if matched, _ := regexp.MatchString(`/alerts/(new|edit)(?:\?.*)?$`, referrer); matched {-+ if alertMatched {if alertIDRegex, err := regexp.Compile(`ruleId=(\d+)`); err == nil {if matches := alertIDRegex.FindStringSubmatch(referrer); len(matches) > 1 {- properties["alert_id"] = matches[1]+ properties["rule_id"] = matches[1]}}+ }- properties["module_name"] = "rule"- aH.Signoz.Analytics.TrackUser(r.Context(), claims.OrgID, claims.UserID, "Telemetry Query Returned Results", properties)+ // Check if result is empty or has no data+ if len(result) == 0 {+ aH.Signoz.Analytics.TrackUser(r.Context(), claims.OrgID, claims.UserID, "Telemetry Query Returned Empty", properties)return}+ // Check if first result has no series data+ if len(result[0].Series) == 0 {+ // Check if first result has no list data+ if len(result[0].List) == 0 {+ // Check if first result has no table data+ if result[0].Table == nil {+ aH.Signoz.Analytics.TrackUser(r.Context(), claims.OrgID, claims.UserID, "Telemetry Query Returned Empty", properties)+ return+ }++ if len(result[0].Table.Rows) == 0 {+ aH.Signoz.Analytics.TrackUser(r.Context(), claims.OrgID, claims.UserID, "Telemetry Query Returned Empty", properties)+ return+ }+ }+ }+aH.Signoz.Analytics.TrackUser(r.Context(), claims.OrgID, claims.UserID, "Telemetry Query Returned Results", properties)}