diff --git a/pkg/query-service/app/clickhouseReader/reader.go b/pkg/query-service/app/clickhouseReader/reader.go index f63b4d3453..256ab98d68 100644 --- a/pkg/query-service/app/clickhouseReader/reader.go +++ b/pkg/query-service/app/clickhouseReader/reader.go @@ -2540,7 +2540,7 @@ func (r *ClickHouseReader) GetTotalLogs(ctx context.Context) (uint64, error) { var totalLogs uint64 - queryStr := fmt.Sprintf("SELECT count() from %s.%s;", r.logsDB, r.logsTable) + queryStr := fmt.Sprintf("SELECT count() from %s.%s;", r.logsDB, r.logsTableName) r.db.QueryRow(ctx, queryStr).Scan(&totalLogs) return totalLogs, nil diff --git a/pkg/query-service/app/dashboards/model.go b/pkg/query-service/app/dashboards/model.go index d4b11d8502..99aa53ef9c 100644 --- a/pkg/query-service/app/dashboards/model.go +++ b/pkg/query-service/app/dashboards/model.go @@ -472,6 +472,11 @@ func GetDashboardsInfo(ctx context.Context) (*model.DashboardsInfo, error) { if isDashboardWithTSV2(dashboard.Data) { count = count + 1 } + + if dashboardInfo.DashboardsWithTraceChQuery > 0 { + dashboardsInfo.DashboardNamesWithTraceChQuery = append(dashboardsInfo.DashboardNamesWithTraceChQuery, dashboardName) + } + // check if dashboard is a has a log operator with contains } @@ -505,6 +510,8 @@ func isDashboardWithTracesClickhouseQuery(data map[string]interface{}) bool { if err != nil { return false } + + // also check if the query is actually active str := string(jsonData) result := strings.Contains(str, "signoz_traces.distributed_signoz_index_v2") || strings.Contains(str, "signoz_traces.distributed_signoz_spans") || diff --git a/pkg/query-service/model/response.go b/pkg/query-service/model/response.go index d0d4a51b60..c4e743ce92 100644 --- a/pkg/query-service/model/response.go +++ b/pkg/query-service/model/response.go @@ -658,6 +658,7 @@ type DashboardsInfo struct { QueriesWithTSV2 int `json:"queriesWithTSV2"` DashboardsWithLogsChQuery int `json:"dashboardsWithLogsChQuery"` DashboardsWithTraceChQuery int `json:"dashboardsWithTraceChQuery"` + DashboardNamesWithTraceChQuery []string `json:"dashboardNamesWithTraceChQuery"` LogsPanelsWithAttrContainsOp int `json:"logsPanelsWithAttrContainsOp"` } diff --git a/pkg/query-service/telemetry/telemetry.go b/pkg/query-service/telemetry/telemetry.go index 0de96a0f69..3361a69331 100644 --- a/pkg/query-service/telemetry/telemetry.go +++ b/pkg/query-service/telemetry/telemetry.go @@ -347,6 +347,7 @@ func createTelemetry() { "dashboardsWithTSV2": dashboardsInfo.QueriesWithTSV2, "dashboardWithLogsChQuery": dashboardsInfo.DashboardsWithLogsChQuery, "dashboardWithTraceChQuery": dashboardsInfo.DashboardsWithTraceChQuery, + "dashboardNamesWithTraceChQuery": dashboardsInfo.DashboardNamesWithTraceChQuery, "totalAlerts": alertsInfo.TotalAlerts, "alertsWithTSV2": alertsInfo.AlertsWithTSV2, "logsBasedAlerts": alertsInfo.LogsBasedAlerts,