Skip to content

Commit

Permalink
fix: add dashbard names and update logs count in telemetry (#6553)
Browse files Browse the repository at this point in the history
  • Loading branch information
nityanandagohain authored Nov 28, 2024
1 parent 813cd84 commit f7f8bf1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/query-service/app/clickhouseReader/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions pkg/query-service/app/dashboards/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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") ||
Expand Down
1 change: 1 addition & 0 deletions pkg/query-service/model/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down
1 change: 1 addition & 0 deletions pkg/query-service/telemetry/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f7f8bf1

Please sign in to comment.