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: dashboard and alert names (#5705)
Vishal Sharma871e5ada9e7d
diff --git a/pkg/query-service/app/clickhouseReader/reader.go b/pkg/query-service/app/clickhouseReader/reader.goindex 5f33bfe2a9..8dce05250d 100644--- a/pkg/query-service/app/clickhouseReader/reader.go+++ b/pkg/query-service/app/clickhouseReader/reader.go@@ -3346,16 +3346,26 @@ func (r *ClickHouseReader) GetDashboardsInfo(ctx context.Context) (*model.Dashboreturn &dashboardsInfo, err}totalDashboardsWithPanelAndName := 0+ var dashboardNames []stringcount := 0for _, dashboard := range dashboardsData {if isDashboardWithPanelAndName(dashboard.Data) {totalDashboardsWithPanelAndName = totalDashboardsWithPanelAndName + 1}- dashboardsInfo = countPanelsInDashboard(dashboard.Data)+ dashboardName := extractDashboardName(dashboard.Data)+ if dashboardName != "" {+ dashboardNames = append(dashboardNames, dashboardName)+ }+ dashboardInfo := countPanelsInDashboard(dashboard.Data)+ dashboardsInfo.LogsBasedPanels += dashboardInfo.LogsBasedPanels+ dashboardsInfo.TracesBasedPanels += dashboardInfo.TracesBasedPanels+ dashboardsInfo.MetricBasedPanels += dashboardsInfo.MetricBasedPanelsif isDashboardWithTSV2(dashboard.Data) {count = count + 1}}++ dashboardsInfo.DashboardNames = dashboardNamesdashboardsInfo.TotalDashboards = len(dashboardsData)dashboardsInfo.TotalDashboardsWithPanelAndName = totalDashboardsWithPanelAndNamedashboardsInfo.QueriesWithTSV2 = count@@ -3389,6 +3399,19 @@ func isDashboardWithPanelAndName(data map[string]interface{}) bool {return isDashboardWithPanelAndName}++func extractDashboardName(data map[string]interface{}) string {++ if data != nil && data["title"] != nil {+ title, ok := data["title"].(string)+ if ok {+ return title+ }+ }++ return ""+}+func countPanelsInDashboard(data map[string]interface{}) model.DashboardsInfo {var logsPanelCount, tracesPanelCount, metricsPanelCount int// totalPanels := 0diff --git a/pkg/query-service/model/response.go b/pkg/query-service/model/response.goindex b8250bd1d3..83df872175 100644--- a/pkg/query-service/model/response.go+++ b/pkg/query-service/model/response.go@@ -634,21 +634,22 @@ type TagsInfo struct {}type AlertsInfo struct {- TotalAlerts int `json:"totalAlerts"`- LogsBasedAlerts int `json:"logsBasedAlerts"`- MetricBasedAlerts int `json:"metricBasedAlerts"`- TracesBasedAlerts int `json:"tracesBasedAlerts"`- SlackChannels int `json:"slackChannels"`- WebHookChannels int `json:"webHookChannels"`- PagerDutyChannels int `json:"pagerDutyChannels"`- OpsGenieChannels int `json:"opsGenieChannels"`- EmailChannels int `json:"emailChannels"`- MSTeamsChannels int `json:"microsoftTeamsChannels"`- MetricsBuilderQueries int `json:"metricsBuilderQueries"`- MetricsClickHouseQueries int `json:"metricsClickHouseQueries"`- MetricsPrometheusQueries int `json:"metricsPrometheusQueries"`- SpanMetricsPrometheusQueries int `json:"spanMetricsPrometheusQueries"`- AlertsWithTSV2 int `json:"alertsWithTSv2"`+ TotalAlerts int `json:"totalAlerts"`+ LogsBasedAlerts int `json:"logsBasedAlerts"`+ MetricBasedAlerts int `json:"metricBasedAlerts"`+ TracesBasedAlerts int `json:"tracesBasedAlerts"`+ SlackChannels int `json:"slackChannels"`+ WebHookChannels int `json:"webHookChannels"`+ PagerDutyChannels int `json:"pagerDutyChannels"`+ OpsGenieChannels int `json:"opsGenieChannels"`+ EmailChannels int `json:"emailChannels"`+ MSTeamsChannels int `json:"microsoftTeamsChannels"`+ MetricsBuilderQueries int `json:"metricsBuilderQueries"`+ MetricsClickHouseQueries int `json:"metricsClickHouseQueries"`+ MetricsPrometheusQueries int `json:"metricsPrometheusQueries"`+ SpanMetricsPrometheusQueries int `json:"spanMetricsPrometheusQueries"`+ AlertNames []string `json:"alertNames"`+ AlertsWithTSV2 int `json:"alertsWithTSv2"`}type SavedViewsInfo struct {@@ -658,12 +659,13 @@ type SavedViewsInfo struct {}type DashboardsInfo struct {- TotalDashboards int `json:"totalDashboards"`- TotalDashboardsWithPanelAndName int `json:"totalDashboardsWithPanelAndName"` // dashboards with panel and name without sample title- LogsBasedPanels int `json:"logsBasedPanels"`- MetricBasedPanels int `json:"metricBasedPanels"`- QueriesWithTSV2 int `json:"queriesWithTSV2"`- TracesBasedPanels int `json:"tracesBasedPanels"`+ TotalDashboards int `json:"totalDashboards"`+ TotalDashboardsWithPanelAndName int `json:"totalDashboardsWithPanelAndName"` // dashboards with panel and name without sample title+ LogsBasedPanels int `json:"logsBasedPanels"`+ MetricBasedPanels int `json:"metricBasedPanels"`+ TracesBasedPanels int `json:"tracesBasedPanels"`+ DashboardNames []string `json:"dashboardNames"`+ QueriesWithTSV2 int `json:"queriesWithTSV2"`}type TagTelemetryData struct {diff --git a/pkg/query-service/rules/db.go b/pkg/query-service/rules/db.goindex c49a8dd391..37e45f2711 100644--- a/pkg/query-service/rules/db.go+++ b/pkg/query-service/rules/db.go@@ -308,6 +308,7 @@ func (r *ruleDB) GetAlertsInfo(ctx context.Context) (*model.AlertsInfo, error) {// fetch alerts from rules dbquery := "SELECT data FROM rules"var alertsData []string+ var alertNames []stringerr := r.Select(&alertsData, query)if err != nil {zap.L().Error("Error in processing sql query", zap.Error(err))@@ -323,6 +324,7 @@ func (r *ruleDB) GetAlertsInfo(ctx context.Context) (*model.AlertsInfo, error) {zap.L().Error("invalid rule data", zap.Error(err))continue}+ alertNames = append(alertNames, rule.AlertName)if rule.AlertType == "LOGS_BASED_ALERT" {alertsInfo.LogsBasedAlerts = alertsInfo.LogsBasedAlerts + 1} else if rule.AlertType == "METRIC_BASED_ALERT" {@@ -346,6 +348,6 @@ func (r *ruleDB) GetAlertsInfo(ctx context.Context) (*model.AlertsInfo, error) {}alertsInfo.TotalAlerts = alertsInfo.TotalAlerts + 1}-+ alertsInfo.AlertNames = alertNamesreturn &alertsInfo, nil}diff --git a/pkg/query-service/telemetry/telemetry.go b/pkg/query-service/telemetry/telemetry.goindex ecfa86298e..c916135f4e 100644--- a/pkg/query-service/telemetry/telemetry.go+++ b/pkg/query-service/telemetry/telemetry.go@@ -314,6 +314,8 @@ func createTelemetry() {dashboardsAlertsData := map[string]interface{}{"totalDashboards": dashboardsInfo.TotalDashboards,"totalDashboardsWithPanelAndName": dashboardsInfo.TotalDashboardsWithPanelAndName,+ "dashboardNames": dashboardsInfo.DashboardNames,+ "alertNames": alertsInfo.AlertNames,"logsBasedPanels": dashboardsInfo.LogsBasedPanels,"metricBasedPanels": dashboardsInfo.MetricBasedPanels,"tracesBasedPanels": dashboardsInfo.TracesBasedPanels,