Skip to content

Commit

Permalink
[Querier] Resource translate and showtagvalues add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Ericsssss authored and SongZhen0704 committed Apr 29, 2024
1 parent 624c714 commit 0e369be
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions server/querier/engine/clickhouse/tag/description.go
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,10 @@ func GetTagValues(db, table, sql, queryCacheTTL, orgID string, useQueryCache boo
}

func GetTagResourceValues(db, table, rawSql string) (*common.Result, []string, error) {
// Resource tag showtagvalues:
// Device resources, auto_instance, auto_service and resources without their own map, use device_map.
// Resources that have their own map, use their own map.

sqlSplit := strings.Fields(rawSql)
tag := sqlSplit[2]
tag = strings.Trim(tag, "'")
Expand Down
6 changes: 6 additions & 0 deletions server/querier/engine/clickhouse/tag/translation.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ var INT_ENUM_PEER_TAG = []string{"resource_gl0_type", "resource_gl1_type", "reso
var STRING_ENUM_TAG = []string{"observation_point", "event_type", "profile_language_type"}

func GenerateTagResoureMap() map[string]map[string]*Tag {
// Resource tag translation:
// Device resources, auto_instance, auto_service and resources without their own map, use device_map.
// Resources that have their own map, use their own map.
// pod_service, pod_ingress, lb_listener, natgw, lb are used as related resources, and ip_relation_map is used for filtering.
// Use device_map when querying natgw, lb, pod_service.

tagResourceMap := make(map[string]map[string]*Tag)
// 资源:区域,可用区,容器节点,命名空间,工作负载,容器POD,容器集群,子网
for _, resourceStr := range TAG_RESOURCE_TYPE_DEFAULT {
Expand Down

0 comments on commit 0e369be

Please sign in to comment.