mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-13 17:09:01 +08:00
chore: add telemetry for dashboards/alerts with tsv2 table (#5677)
This commit is contained in:
parent
5d903b5487
commit
29f1883edd
@ -3346,17 +3346,30 @@ func (r *ClickHouseReader) GetDashboardsInfo(ctx context.Context) (*model.Dashbo
|
||||
return &dashboardsInfo, err
|
||||
}
|
||||
totalDashboardsWithPanelAndName := 0
|
||||
count := 0
|
||||
for _, dashboard := range dashboardsData {
|
||||
if isDashboardWithPanelAndName(dashboard.Data) {
|
||||
totalDashboardsWithPanelAndName = totalDashboardsWithPanelAndName + 1
|
||||
}
|
||||
dashboardsInfo = countPanelsInDashboard(dashboard.Data)
|
||||
if isDashboardWithTSV2(dashboard.Data) {
|
||||
count = count + 1
|
||||
}
|
||||
}
|
||||
dashboardsInfo.TotalDashboards = len(dashboardsData)
|
||||
dashboardsInfo.TotalDashboardsWithPanelAndName = totalDashboardsWithPanelAndName
|
||||
dashboardsInfo.QueriesWithTSV2 = count
|
||||
return &dashboardsInfo, nil
|
||||
}
|
||||
|
||||
func isDashboardWithTSV2(data map[string]interface{}) bool {
|
||||
jsonData, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return strings.Contains(string(jsonData), "time_series_v2")
|
||||
}
|
||||
|
||||
func isDashboardWithPanelAndName(data map[string]interface{}) bool {
|
||||
isDashboardName := false
|
||||
isDashboardWithPanelAndName := false
|
||||
|
@ -648,6 +648,7 @@ type AlertsInfo struct {
|
||||
MetricsClickHouseQueries int `json:"metricsClickHouseQueries"`
|
||||
MetricsPrometheusQueries int `json:"metricsPrometheusQueries"`
|
||||
SpanMetricsPrometheusQueries int `json:"spanMetricsPrometheusQueries"`
|
||||
AlertsWithTSV2 int `json:"alertsWithTSv2"`
|
||||
}
|
||||
|
||||
type SavedViewsInfo struct {
|
||||
@ -661,6 +662,7 @@ type DashboardsInfo struct {
|
||||
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"`
|
||||
}
|
||||
|
||||
|
@ -315,6 +315,9 @@ func (r *ruleDB) GetAlertsInfo(ctx context.Context) (*model.AlertsInfo, error) {
|
||||
}
|
||||
for _, alert := range alertsData {
|
||||
var rule GettableRule
|
||||
if strings.Contains(alert, "time_series_v2") {
|
||||
alertsInfo.AlertsWithTSV2 = alertsInfo.AlertsWithTSV2 + 1
|
||||
}
|
||||
err = json.Unmarshal([]byte(alert), &rule)
|
||||
if err != nil {
|
||||
zap.L().Error("invalid rule data", zap.Error(err))
|
||||
|
@ -317,7 +317,9 @@ func createTelemetry() {
|
||||
"logsBasedPanels": dashboardsInfo.LogsBasedPanels,
|
||||
"metricBasedPanels": dashboardsInfo.MetricBasedPanels,
|
||||
"tracesBasedPanels": dashboardsInfo.TracesBasedPanels,
|
||||
"dashboardsWithTSV2": dashboardsInfo.QueriesWithTSV2,
|
||||
"totalAlerts": alertsInfo.TotalAlerts,
|
||||
"alertsWithTSV2": alertsInfo.AlertsWithTSV2,
|
||||
"logsBasedAlerts": alertsInfo.LogsBasedAlerts,
|
||||
"metricBasedAlerts": alertsInfo.MetricBasedAlerts,
|
||||
"tracesBasedAlerts": alertsInfo.TracesBasedAlerts,
|
||||
|
Loading…
x
Reference in New Issue
Block a user