mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-07 12:31:46 +08:00
chore: add queries with tag attributes v1 (#6643)
This commit is contained in:
parent
b29359dee0
commit
bef5b96c5c
@ -458,6 +458,7 @@ func GetDashboardsInfo(ctx context.Context) (*model.DashboardsInfo, error) {
|
|||||||
totalDashboardsWithPanelAndName := 0
|
totalDashboardsWithPanelAndName := 0
|
||||||
var dashboardNames []string
|
var dashboardNames []string
|
||||||
count := 0
|
count := 0
|
||||||
|
queriesWithTagAttrs := 0
|
||||||
for _, dashboard := range dashboardsData {
|
for _, dashboard := range dashboardsData {
|
||||||
if isDashboardWithPanelAndName(dashboard.Data) {
|
if isDashboardWithPanelAndName(dashboard.Data) {
|
||||||
totalDashboardsWithPanelAndName = totalDashboardsWithPanelAndName + 1
|
totalDashboardsWithPanelAndName = totalDashboardsWithPanelAndName + 1
|
||||||
@ -477,6 +478,10 @@ func GetDashboardsInfo(ctx context.Context) (*model.DashboardsInfo, error) {
|
|||||||
count = count + 1
|
count = count + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if isDashboardWithTagAttrs(dashboard.Data) {
|
||||||
|
queriesWithTagAttrs += 1
|
||||||
|
}
|
||||||
|
|
||||||
if dashboardInfo.DashboardsWithTraceChQuery > 0 {
|
if dashboardInfo.DashboardsWithTraceChQuery > 0 {
|
||||||
dashboardsInfo.DashboardNamesWithTraceChQuery = append(dashboardsInfo.DashboardNamesWithTraceChQuery, dashboardName)
|
dashboardsInfo.DashboardNamesWithTraceChQuery = append(dashboardsInfo.DashboardNamesWithTraceChQuery, dashboardName)
|
||||||
}
|
}
|
||||||
@ -488,6 +493,7 @@ func GetDashboardsInfo(ctx context.Context) (*model.DashboardsInfo, error) {
|
|||||||
dashboardsInfo.TotalDashboards = len(dashboardsData)
|
dashboardsInfo.TotalDashboards = len(dashboardsData)
|
||||||
dashboardsInfo.TotalDashboardsWithPanelAndName = totalDashboardsWithPanelAndName
|
dashboardsInfo.TotalDashboardsWithPanelAndName = totalDashboardsWithPanelAndName
|
||||||
dashboardsInfo.QueriesWithTSV2 = count
|
dashboardsInfo.QueriesWithTSV2 = count
|
||||||
|
dashboardsInfo.QueriesWithTagAttrs = queriesWithTagAttrs
|
||||||
return &dashboardsInfo, nil
|
return &dashboardsInfo, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -499,6 +505,15 @@ func isDashboardWithTSV2(data map[string]interface{}) bool {
|
|||||||
return strings.Contains(string(jsonData), "time_series_v2")
|
return strings.Contains(string(jsonData), "time_series_v2")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isDashboardWithTagAttrs(data map[string]interface{}) bool {
|
||||||
|
jsonData, err := json.Marshal(data)
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return strings.Contains(string(jsonData), "span_attributes") ||
|
||||||
|
strings.Contains(string(jsonData), "tag_attributes")
|
||||||
|
}
|
||||||
|
|
||||||
func isDashboardWithLogsClickhouseQuery(data map[string]interface{}) bool {
|
func isDashboardWithLogsClickhouseQuery(data map[string]interface{}) bool {
|
||||||
jsonData, err := json.Marshal(data)
|
jsonData, err := json.Marshal(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -656,6 +656,7 @@ type DashboardsInfo struct {
|
|||||||
TracesBasedPanels int `json:"tracesBasedPanels"`
|
TracesBasedPanels int `json:"tracesBasedPanels"`
|
||||||
DashboardNames []string `json:"dashboardNames"`
|
DashboardNames []string `json:"dashboardNames"`
|
||||||
QueriesWithTSV2 int `json:"queriesWithTSV2"`
|
QueriesWithTSV2 int `json:"queriesWithTSV2"`
|
||||||
|
QueriesWithTagAttrs int `json:"queriesWithTagAttrs"`
|
||||||
DashboardsWithLogsChQuery int `json:"dashboardsWithLogsChQuery"`
|
DashboardsWithLogsChQuery int `json:"dashboardsWithLogsChQuery"`
|
||||||
DashboardsWithTraceChQuery int `json:"dashboardsWithTraceChQuery"`
|
DashboardsWithTraceChQuery int `json:"dashboardsWithTraceChQuery"`
|
||||||
DashboardNamesWithTraceChQuery []string `json:"dashboardNamesWithTraceChQuery"`
|
DashboardNamesWithTraceChQuery []string `json:"dashboardNamesWithTraceChQuery"`
|
||||||
|
@ -345,6 +345,7 @@ func createTelemetry() {
|
|||||||
"metricBasedPanels": dashboardsInfo.MetricBasedPanels,
|
"metricBasedPanels": dashboardsInfo.MetricBasedPanels,
|
||||||
"tracesBasedPanels": dashboardsInfo.TracesBasedPanels,
|
"tracesBasedPanels": dashboardsInfo.TracesBasedPanels,
|
||||||
"dashboardsWithTSV2": dashboardsInfo.QueriesWithTSV2,
|
"dashboardsWithTSV2": dashboardsInfo.QueriesWithTSV2,
|
||||||
|
"dashboardsWithTagAttrs": dashboardsInfo.QueriesWithTagAttrs,
|
||||||
"dashboardWithLogsChQuery": dashboardsInfo.DashboardsWithLogsChQuery,
|
"dashboardWithLogsChQuery": dashboardsInfo.DashboardsWithLogsChQuery,
|
||||||
"dashboardWithTraceChQuery": dashboardsInfo.DashboardsWithTraceChQuery,
|
"dashboardWithTraceChQuery": dashboardsInfo.DashboardsWithTraceChQuery,
|
||||||
"dashboardNamesWithTraceChQuery": dashboardsInfo.DashboardNamesWithTraceChQuery,
|
"dashboardNamesWithTraceChQuery": dashboardsInfo.DashboardNamesWithTraceChQuery,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user