mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-08 00:51:48 +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
|
||||
var dashboardNames []string
|
||||
count := 0
|
||||
queriesWithTagAttrs := 0
|
||||
for _, dashboard := range dashboardsData {
|
||||
if isDashboardWithPanelAndName(dashboard.Data) {
|
||||
totalDashboardsWithPanelAndName = totalDashboardsWithPanelAndName + 1
|
||||
@ -477,6 +478,10 @@ func GetDashboardsInfo(ctx context.Context) (*model.DashboardsInfo, error) {
|
||||
count = count + 1
|
||||
}
|
||||
|
||||
if isDashboardWithTagAttrs(dashboard.Data) {
|
||||
queriesWithTagAttrs += 1
|
||||
}
|
||||
|
||||
if dashboardInfo.DashboardsWithTraceChQuery > 0 {
|
||||
dashboardsInfo.DashboardNamesWithTraceChQuery = append(dashboardsInfo.DashboardNamesWithTraceChQuery, dashboardName)
|
||||
}
|
||||
@ -488,6 +493,7 @@ func GetDashboardsInfo(ctx context.Context) (*model.DashboardsInfo, error) {
|
||||
dashboardsInfo.TotalDashboards = len(dashboardsData)
|
||||
dashboardsInfo.TotalDashboardsWithPanelAndName = totalDashboardsWithPanelAndName
|
||||
dashboardsInfo.QueriesWithTSV2 = count
|
||||
dashboardsInfo.QueriesWithTagAttrs = queriesWithTagAttrs
|
||||
return &dashboardsInfo, nil
|
||||
}
|
||||
|
||||
@ -499,6 +505,15 @@ func isDashboardWithTSV2(data map[string]interface{}) bool {
|
||||
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 {
|
||||
jsonData, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
|
@ -656,6 +656,7 @@ type DashboardsInfo struct {
|
||||
TracesBasedPanels int `json:"tracesBasedPanels"`
|
||||
DashboardNames []string `json:"dashboardNames"`
|
||||
QueriesWithTSV2 int `json:"queriesWithTSV2"`
|
||||
QueriesWithTagAttrs int `json:"queriesWithTagAttrs"`
|
||||
DashboardsWithLogsChQuery int `json:"dashboardsWithLogsChQuery"`
|
||||
DashboardsWithTraceChQuery int `json:"dashboardsWithTraceChQuery"`
|
||||
DashboardNamesWithTraceChQuery []string `json:"dashboardNamesWithTraceChQuery"`
|
||||
|
@ -345,6 +345,7 @@ func createTelemetry() {
|
||||
"metricBasedPanels": dashboardsInfo.MetricBasedPanels,
|
||||
"tracesBasedPanels": dashboardsInfo.TracesBasedPanels,
|
||||
"dashboardsWithTSV2": dashboardsInfo.QueriesWithTSV2,
|
||||
"dashboardsWithTagAttrs": dashboardsInfo.QueriesWithTagAttrs,
|
||||
"dashboardWithLogsChQuery": dashboardsInfo.DashboardsWithLogsChQuery,
|
||||
"dashboardWithTraceChQuery": dashboardsInfo.DashboardsWithTraceChQuery,
|
||||
"dashboardNamesWithTraceChQuery": dashboardsInfo.DashboardNamesWithTraceChQuery,
|
||||
|
Loading…
x
Reference in New Issue
Block a user