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
fix: add telemetry for trace migration (#6537)
Nityananda Gohaina3e57a1829dd
diff --git a/pkg/query-service/app/dashboards/model.go b/pkg/query-service/app/dashboards/model.goindex 21d39fcbe4..d4b11d8502 100644--- a/pkg/query-service/app/dashboards/model.go+++ b/pkg/query-service/app/dashboards/model.go@@ -468,6 +468,7 @@ func GetDashboardsInfo(ctx context.Context) (*model.DashboardsInfo, error) {dashboardsInfo.MetricBasedPanels += dashboardsInfo.MetricBasedPanelsdashboardsInfo.LogsPanelsWithAttrContainsOp += dashboardInfo.LogsPanelsWithAttrContainsOpdashboardsInfo.DashboardsWithLogsChQuery += dashboardInfo.DashboardsWithLogsChQuery+ dashboardsInfo.DashboardsWithTraceChQuery += dashboardInfo.DashboardsWithTraceChQueryif isDashboardWithTSV2(dashboard.Data) {count = count + 1}@@ -499,6 +500,18 @@ func isDashboardWithLogsClickhouseQuery(data map[string]interface{}) bool {return result}+func isDashboardWithTracesClickhouseQuery(data map[string]interface{}) bool {+ jsonData, err := json.Marshal(data)+ if err != nil {+ return false+ }+ str := string(jsonData)+ result := strings.Contains(str, "signoz_traces.distributed_signoz_index_v2") ||+ strings.Contains(str, "signoz_traces.distributed_signoz_spans") ||+ strings.Contains(str, "signoz_traces.distributed_signoz_error_index_v2")+ return result+}+func isDashboardWithPanelAndName(data map[string]interface{}) bool {isDashboardName := falseisDashboardWithPanelAndName := false@@ -559,7 +572,9 @@ func checkLogPanelAttrContains(data map[string]interface{}) int {func countPanelsInDashboard(inputData map[string]interface{}) model.DashboardsInfo {var logsPanelCount, tracesPanelCount, metricsPanelCount, logsPanelsWithAttrContains int- var logChQuery bool+ traceChQueryCount := 0+ logChQueryCount := 0+// totalPanels := 0if inputData != nil && inputData["widgets"] != nil {widgets, ok := inputData["widgets"]@@ -593,7 +608,10 @@ func countPanelsInDashboard(inputData map[string]interface{}) model.DashboardsIn}} else if ok && query["queryType"] == "clickhouse_sql" && query["clickhouse_sql"] != nil {if isDashboardWithLogsClickhouseQuery(inputData) {- logChQuery = true+ logChQueryCount = 1+ }+ if isDashboardWithTracesClickhouseQuery(inputData) {+ traceChQueryCount = 1}}}@@ -602,16 +620,13 @@ func countPanelsInDashboard(inputData map[string]interface{}) model.DashboardsIn}}- logChQueryCount := 0- if logChQuery {- logChQueryCount = 1- }return model.DashboardsInfo{LogsBasedPanels: logsPanelCount,TracesBasedPanels: tracesPanelCount,MetricBasedPanels: metricsPanelCount,DashboardsWithLogsChQuery: logChQueryCount,+ DashboardsWithTraceChQuery: traceChQueryCount,LogsPanelsWithAttrContainsOp: logsPanelsWithAttrContains,}}diff --git a/pkg/query-service/model/response.go b/pkg/query-service/model/response.goindex 4d7fb9d230..d0d4a51b60 100644--- a/pkg/query-service/model/response.go+++ b/pkg/query-service/model/response.go@@ -636,6 +636,7 @@ type AlertsInfo struct {AlertNames []string `json:"alertNames"`AlertsWithTSV2 int `json:"alertsWithTSv2"`AlertsWithLogsChQuery int `json:"alertsWithLogsChQuery"`+ AlertsWithTraceChQuery int `json:"alertsWithTraceChQuery"`AlertsWithLogsContainsOp int `json:"alertsWithLogsContainsOp"`}@@ -656,6 +657,7 @@ type DashboardsInfo struct {DashboardNames []string `json:"dashboardNames"`QueriesWithTSV2 int `json:"queriesWithTSV2"`DashboardsWithLogsChQuery int `json:"dashboardsWithLogsChQuery"`+ DashboardsWithTraceChQuery int `json:"dashboardsWithTraceChQuery"`LogsPanelsWithAttrContainsOp int `json:"logsPanelsWithAttrContainsOp"`}diff --git a/pkg/query-service/rules/db.go b/pkg/query-service/rules/db.goindex c9db38201b..3fe8c5cc95 100644--- a/pkg/query-service/rules/db.go+++ b/pkg/query-service/rules/db.go@@ -604,6 +604,16 @@ func (r *ruleDB) GetAlertsInfo(ctx context.Context) (*model.AlertsInfo, error) {}} else if rule.AlertType == AlertTypeTraces {alertsInfo.TracesBasedAlerts = alertsInfo.TracesBasedAlerts + 1++ if rule.RuleCondition != nil && rule.RuleCondition.CompositeQuery != nil {+ if rule.RuleCondition.CompositeQuery.QueryType == v3.QueryTypeClickHouseSQL {+ if strings.Contains(alert, "signoz_traces.distributed_signoz_index_v2") ||+ strings.Contains(alert, "signoz_traces.distributed_signoz_spans") ||+ strings.Contains(alert, "signoz_traces.distributed_signoz_error_index_v2") {+ alertsInfo.AlertsWithTraceChQuery = alertsInfo.AlertsWithTraceChQuery + 1+ }+ }+ }}alertsInfo.TotalAlerts = alertsInfo.TotalAlerts + 1}diff --git a/pkg/query-service/telemetry/telemetry.go b/pkg/query-service/telemetry/telemetry.goindex 1e2a1a1998..0de96a0f69 100644--- a/pkg/query-service/telemetry/telemetry.go+++ b/pkg/query-service/telemetry/telemetry.go@@ -307,8 +307,11 @@ func createTelemetry() {"getLogsInfoInLastHeartBeatInterval": getLogsInfoInLastHeartBeatInterval,"countUsers": userCount,"metricsTTLStatus": metricsTTL.Status,+ "metricsTTLValue": metricsTTL.MetricsMoveTime,"tracesTTLStatus": traceTTL.Status,+ "traceTTLValue": traceTTL.TracesTime,"logsTTLStatus": logsTTL.Status,+ "logsTTLValue": logsTTL.LogsTime,"patUser": telemetry.patTokenUser,}telemetry.patTokenUser = false@@ -343,6 +346,7 @@ func createTelemetry() {"tracesBasedPanels": dashboardsInfo.TracesBasedPanels,"dashboardsWithTSV2": dashboardsInfo.QueriesWithTSV2,"dashboardWithLogsChQuery": dashboardsInfo.DashboardsWithLogsChQuery,+ "dashboardWithTraceChQuery": dashboardsInfo.DashboardsWithTraceChQuery,"totalAlerts": alertsInfo.TotalAlerts,"alertsWithTSV2": alertsInfo.AlertsWithTSV2,"logsBasedAlerts": alertsInfo.LogsBasedAlerts,@@ -366,6 +370,7 @@ func createTelemetry() {"spanMetricsPrometheusQueries": alertsInfo.SpanMetricsPrometheusQueries,"alertsWithLogsChQuery": alertsInfo.AlertsWithLogsChQuery,"alertsWithLogsContainsOp": alertsInfo.AlertsWithLogsContainsOp,+ "alertsWithTraceChQuery": alertsInfo.AlertsWithTraceChQuery,}// send event only if there are dashboards or alerts or channelsif (dashboardsInfo.TotalDashboards > 0 || alertsInfo.TotalAlerts > 0 || alertsInfo.TotalChannels > 0 || savedViewsInfo.TotalSavedViews > 0) && apiErr == nil {