Skip to content

Commit 3856fc2

Browse files
xiaochaoren1SongZhen0704
authored andcommitted
feat: datasource supports file_event_metrics
1 parent 1013977 commit 3856fc2

3 files changed

Lines changed: 14 additions & 4 deletions

File tree

server/controller/http/service/data_source.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ func (d *DataSource) GetDataSources(orgID int, filter map[string]interface{}, sp
144144
collection = "prometheus.*"
145145
case "traffic_policy":
146146
collection = "flow_metrics.traffic_policy"
147+
case "in_process_metrics":
148+
collection = "profile.in_process_metrics"
149+
case "file_event_metrics":
150+
collection = "event.file_event_metrics"
147151
default:
148152
collection = t.(string)
149153
}

server/querier/engine/clickhouse/clickhouse.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ func (e *CHEngine) ParseShowSql(sql string, args *common.QuerierParams, DebugInf
490490
formatMetricByLanguage(args.Language, result.Values)
491491
}
492492
return result, []string{}, true, err
493-
case 4: // show tag X values from Y X, Y not nil
493+
case 4: // show tag X values from Y; X, Y not nil
494494
result, sqlList, err := tagdescription.GetTagValues(e.DB, table, sql, args.QueryCacheTTL, args.ORGID, args.Language, args.UseQueryCache)
495495
e.DB = "flow_tag"
496496
return result, sqlList, true, err
@@ -506,7 +506,7 @@ func (e *CHEngine) ParseShowSql(sql string, args *common.QuerierParams, DebugInf
506506
formatTagByLanguage(args.Language, data.Values)
507507
}
508508
return data, []string{}, true, err
509-
case 6: // show tables...
509+
case 6: // show tables...
510510
if e.DB == chCommon.DB_NAME_DEEPFLOW_TENANT && len(visibilityFilter) > 0 {
511511
where = visibilityWhere
512512
}
@@ -515,7 +515,7 @@ func (e *CHEngine) ParseShowSql(sql string, args *common.QuerierParams, DebugInf
515515
result.Values = dataVisibilityfiltering(visibilityFilterRegexp, result.Values)
516516
}
517517
return result, []string{}, true, nil
518-
case 7: // show databases...
518+
case 7: // show databases...
519519
result := GetDatabases()
520520
if len(visibilityFilter) > 0 {
521521
result.Values = dataVisibilityfiltering(visibilityFilterRegexp, result.Values)

server/querier/engine/clickhouse/common/utils.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,20 @@ func ParseResponse(response *http.Response) (map[string]interface{}, error) {
110110
func GetDatasources(db string, table string, orgID string) ([]string, error) {
111111
var datasources []string
112112
switch db {
113-
case "flow_metrics":
113+
case "flow_metrics", DB_NAME_PROFILE, DB_NAME_EVENT:
114114
var tsdbType string
115115
if table == "network" || table == "network_map" {
116116
tsdbType = "network"
117117
} else if table == "application" || table == "application_map" {
118118
tsdbType = "application"
119119
} else if table == TABLE_NAME_VTAP_ACL {
120120
tsdbType = TABLE_NAME_VTAP_ACL
121+
} else if table == TABLE_NAME_IN_PROCESS_METRICS {
122+
tsdbType = TABLE_NAME_IN_PROCESS_METRICS
123+
} else if table == TABLE_NAME_FILE_EVENT_METRICS {
124+
tsdbType = TABLE_NAME_FILE_EVENT_METRICS
125+
} else {
126+
return datasources, nil
121127
}
122128
client := &http.Client{}
123129
url := fmt.Sprintf("http://localhost:%d/v1/data-sources/?type=%s", config.ControllerCfg.ListenPort, tsdbType)

0 commit comments

Comments
 (0)