mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 10:45:57 +08:00
fix: add back temlemetry for dashboard with logs queries (#5997)
This commit is contained in:
parent
a9841755a7
commit
72cbc1a9e7
@ -453,6 +453,7 @@ func GetDashboardsInfo(ctx context.Context) (*model.DashboardsInfo, error) {
|
|||||||
totalDashboardsWithPanelAndName := 0
|
totalDashboardsWithPanelAndName := 0
|
||||||
var dashboardNames []string
|
var dashboardNames []string
|
||||||
count := 0
|
count := 0
|
||||||
|
logChQueriesCount := 0
|
||||||
for _, dashboard := range dashboardsData {
|
for _, dashboard := range dashboardsData {
|
||||||
if isDashboardWithPanelAndName(dashboard.Data) {
|
if isDashboardWithPanelAndName(dashboard.Data) {
|
||||||
totalDashboardsWithPanelAndName = totalDashboardsWithPanelAndName + 1
|
totalDashboardsWithPanelAndName = totalDashboardsWithPanelAndName + 1
|
||||||
@ -468,12 +469,16 @@ func GetDashboardsInfo(ctx context.Context) (*model.DashboardsInfo, error) {
|
|||||||
if isDashboardWithTSV2(dashboard.Data) {
|
if isDashboardWithTSV2(dashboard.Data) {
|
||||||
count = count + 1
|
count = count + 1
|
||||||
}
|
}
|
||||||
|
if isDashboardWithLogsClickhouseQuery(dashboard.Data) {
|
||||||
|
logChQueriesCount = logChQueriesCount + 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dashboardsInfo.DashboardNames = dashboardNames
|
dashboardsInfo.DashboardNames = dashboardNames
|
||||||
dashboardsInfo.TotalDashboards = len(dashboardsData)
|
dashboardsInfo.TotalDashboards = len(dashboardsData)
|
||||||
dashboardsInfo.TotalDashboardsWithPanelAndName = totalDashboardsWithPanelAndName
|
dashboardsInfo.TotalDashboardsWithPanelAndName = totalDashboardsWithPanelAndName
|
||||||
dashboardsInfo.QueriesWithTSV2 = count
|
dashboardsInfo.QueriesWithTSV2 = count
|
||||||
|
dashboardsInfo.DashboardsWithLogsChQuery = logChQueriesCount
|
||||||
return &dashboardsInfo, nil
|
return &dashboardsInfo, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,6 +490,16 @@ func isDashboardWithTSV2(data map[string]interface{}) bool {
|
|||||||
return strings.Contains(string(jsonData), "time_series_v2")
|
return strings.Contains(string(jsonData), "time_series_v2")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isDashboardWithLogsClickhouseQuery(data map[string]interface{}) bool {
|
||||||
|
jsonData, err := json.Marshal(data)
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
result := strings.Contains(string(jsonData), "signoz_logs.distributed_logs ") ||
|
||||||
|
strings.Contains(string(jsonData), "signoz_logs.logs ")
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
func isDashboardWithPanelAndName(data map[string]interface{}) bool {
|
func isDashboardWithPanelAndName(data map[string]interface{}) bool {
|
||||||
isDashboardName := false
|
isDashboardName := false
|
||||||
isDashboardWithPanelAndName := false
|
isDashboardWithPanelAndName := false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user