Skip to content

Commit df37d93

Browse files
committed
feat: querier add table in_process_metrics
1 parent c53349e commit df37d93

File tree

10 files changed

+181
-5
lines changed

10 files changed

+181
-5
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Field , DBField , Type , Category , Permission
2+
profile_value , profile_value , counter , APP Profile , 111
3+
row , , other , Other , 111
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Field , DisplayName , Unit , Description
2+
profile_value , profile_value , ,
3+
row , 行数 , 个 ,
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Field , DisplayName , Unit , Description
2+
profile_value , profile_value , ,
3+
row , Row Count , ,
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Name , ClientName , ServerName , Type , EnumFile , Category , Permission , Deprecated
2+
time , time , time , time , , Timestamp , 111 , 0
3+
4+
region , region , region , resource , , Universal Tag , 110 , 0
5+
az , az , az , resource , , Universal Tag , 110 , 0
6+
host , host , host , resource , , Universal Tag , 100 , 0
7+
chost , chost , chost , resource , , Universal Tag , 111 , 0
8+
vpc , vpc , vpc , resource , , Universal Tag , 111 , 0
9+
router , router , router , resource , , Universal Tag , 110 , 0
10+
dhcpgw , dhcpgw , dhcpgw , resource , , Universal Tag , 110 , 0
11+
lb , lb , lb , resource , , Universal Tag , 110 , 0
12+
lb_listener , lb_listener , lb_listener , resource , , Universal Tag , 110 , 0
13+
natgw , natgw , natgw , resource , , Universal Tag , 110 , 0
14+
redis , redis , redis , resource , , Universal Tag , 110 , 0
15+
rds , rds , rds , resource , , Universal Tag , 110 , 0
16+
pod_cluster , pod_cluster , pod_cluster , resource , , Universal Tag , 111 , 0
17+
pod_ns , pod_ns , pod_ns , resource , , Universal Tag , 111 , 0
18+
pod_node , pod_node , pod_node , resource , , Universal Tag , 111 , 0
19+
pod_ingress , pod_ingress , pod_ingress , resource , , Universal Tag , 111 , 0
20+
pod_service , pod_service , pod_service , resource , , Universal Tag , 111 , 0
21+
pod_group_type , pod_group_type , pod_group_type , int_enum , pod_group_type , Universal Tag , 111 , 0
22+
pod_group , pod_group , pod_group , resource , , Universal Tag , 111 , 0
23+
pod , pod , pod , resource , , Universal Tag , 111 , 0
24+
service , service , service , resource , , Universal Tag , 111 , 1
25+
auto_instance_type , auto_instance_type , auto_instance_type , int_enum , auto_instance_type , Universal Tag , 111 , 0
26+
auto_instance , auto_instance , auto_instance , resource , , Universal Tag , 111 , 0
27+
auto_service_type , auto_service_type , auto_service_type , int_enum , auto_service_type , Universal Tag , 111 , 0
28+
auto_service , auto_service , auto_service , resource , , Universal Tag , 111 , 0
29+
gprocess , gprocess , gprocess , resource , , Universal Tag , 111 , 0
30+
host_ip , host_ip , host_ip , resource , , Universal Tag , 111 , 0
31+
host_hostname , host_hostname , host_hostname , resource , , Universal Tag , 111 , 0
32+
chost_ip , chost_ip , chost_ip , resource , , Universal Tag , 111 , 0
33+
chost_hostname , chost_hostname , chost_hostname , resource , , Universal Tag , 111 , 0
34+
pod_node_ip , pod_node_ip , pod_node_ip , resource , , Universal Tag , 111 , 0
35+
pod_node_hostname , pod_node_hostname , pod_node_hostname , resource , , Universal Tag , 111 , 0
36+
37+
k8s.label , k8s.label , k8s.label , map , , Custom Tag , 111 , 0
38+
k8s.annotation , k8s.annotation , k8s.annotation , map , , Custom Tag , 111 , 0
39+
k8s.env , k8s.env , k8s.env , map , , Custom Tag , 111 , 0
40+
cloud.tag , cloud.tag , cloud.tag , map , , Custom Tag , 111 , 0
41+
42+
ip , ip , ip , ip , , Network Layer , 111 , 0
43+
is_ipv4 , is_ipv4 , is_ipv4 , int_enum , ip_type , Network Layer , 111 , 0
44+
45+
app_service , app_service , app_service , string_enum , , Service Info , 111 , 0
46+
app_instance , app_instance , app_instance , string_enum , , Service Info , 111 , 0
47+
process_id , process_id , process_id , int , , Service Info , 111 , 0
48+
49+
vtap , vtap , vtap , resource , , Capture Info , 111 , 1
50+
agent , agent , agent , resource , , Capture Info , 111 , 0
51+
52+
profile_event_type , profile_event_type , profile_event_type , string , , Profile Info , 111 , 0
53+
profile_language_type , profile_language_type , profile_language_type , string_enum , profile_language_type , Profile Info , 111 , 0
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Name , DisplayName , Description
2+
time , 时间 ,
3+
4+
region , 区域 ,
5+
az , 可用区 ,
6+
host , 宿主机 , 承载虚拟机的宿主机。
7+
chost , 云主机 , 包括虚拟机、裸金属服务器。
8+
vpc , VPC ,
9+
router , 路由器 ,
10+
dhcpgw , DHCP 网关 ,
11+
lb , 负载均衡器 ,
12+
lb_listener , 负载均衡监听器 ,
13+
natgw , NAT 网关 ,
14+
redis , Redis ,
15+
rds , RDS ,
16+
pod_cluster , K8s 容器集群 ,
17+
pod_ns , K8s 命名空间 ,
18+
pod_node , K8s 容器节点 ,
19+
pod_ingress , K8s Ingress ,
20+
pod_service , K8s 容器服务 ,
21+
pod_group_type , K8s 工作负载类型 ,
22+
pod_group , K8s 工作负载 , 例如 Deployment、StatefulSet、Daemonset 等。
23+
pod , K8s 容器 POD ,
24+
service , 服务 , 已废弃,请使用 pod_service
25+
auto_instance_type , 自动实例类型 , `auto_instance`实例对应的类型。
26+
auto_instance , 自动实例 , IP 对应的实例,实例为IP时,auto_instance_id显示为子网ID。
27+
auto_service_type , 自动服务类型 , `auto_service`实例对应的类型。
28+
auto_service , 自动服务 , 在`auto_instance`基础上,将容器服务的 ClusterIP 与工作负载聚合为服务,实例为IP时,auto_service_id显示为子网ID。
29+
gprocess , 进程 ,
30+
host_ip , 宿主机 , 宿主机的管理 IP。
31+
host_hostname , 宿主机 , 宿主机的 Hostname。
32+
chost_ip , 云主机 , 云主机的主 IP。
33+
chost_hostname , 云主机 , 云主机的 Hostname。
34+
pod_node_ip , K8s 容器节点 , 容器节点的主 IP。
35+
pod_node_hostname , K8s 容器节点 , 容器节点的 Hostname。
36+
37+
k8s.label , K8s Label ,
38+
k8s.annotation , K8s Annotation ,
39+
k8s.env , K8s Env ,
40+
cloud.tag , Cloud Tag ,
41+
42+
ip , IP 地址 ,
43+
is_ipv4 , IPv4 标志 ,
44+
45+
app_service , 应用服务 ,
46+
app_instance , 应用实例 ,
47+
process_id , 进程 ID ,
48+
49+
vtap , 采集器 , 已废弃,请使用 agent。
50+
agent , 采集器 ,
51+
52+
profile_event_type , 剖析类型 ,
53+
profile_language_type , 语言类型 ,
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Name , DisplayName , Description
2+
time , Time , Round end_time to seconds.
3+
4+
region , Region ,
5+
az , Availability Zone ,
6+
host , VM Hypervisor , Host running virtual machine.
7+
chost , Cloud Host , Including virtual machines, bare metal servers.
8+
vpc , VPC ,
9+
router , Router ,
10+
dhcpgw , DHCP Gateway ,
11+
lb , Load Balancer ,
12+
lb_listener , Load Balancer Listener ,
13+
natgw , NAT Gateway ,
14+
redis , Redis ,
15+
rds , RDS ,
16+
pod_cluster , K8s Cluster ,
17+
pod_ns , K8s Namespace ,
18+
pod_node , K8s Node ,
19+
pod_ingress , K8s Ingress ,
20+
pod_service , K8s Service ,
21+
pod_group_type , K8s Workload Type ,
22+
pod_group , K8s Workload , Such as Deployment, StatefulSet, Daemonset, etc.
23+
pod , K8s POD ,
24+
service , Service , Deprecated,please use pod_service
25+
auto_instance_type , Auto Instance Type , The type of 'auto_instance'.
26+
auto_instance , Auto Instance Tag , The instance of IP, when the instance is an IP, auto_instance_id displayed as a subnet ID.
27+
auto_service_type , Auto Service Type , The type of 'auto_service'.
28+
auto_service , Auto Service Tag , On the basis of 'auto_instance', aggregate K8s service ClusterIP and workload into service, when the instance is an IP, auto_service_id displayed as a subnet ID.
29+
gprocess , Process ,
30+
host_ip , VM Hypervisor , The management IP address of VM Hypervisor.
31+
host_hostname , VM Hypervisor , The hostname of VM Hypervisor.
32+
chost_ip , Cloud Host , The primary IP address of Cloud Host.
33+
chost_hostname , Cloud Host , The hostname of Cloud Host.
34+
pod_node_ip , K8s Node , The primary IP address of K8s Node.
35+
pod_node_hostname , K8s Node , The hostname of K8s Node.
36+
37+
k8s.label , K8s Label ,
38+
k8s.annotation , K8s Annotation ,
39+
k8s.env , K8s Env ,
40+
cloud.tag , Cloud Tag ,
41+
42+
ip , IP Address ,
43+
is_ipv4 , IPv4 Flag ,
44+
45+
app_service , Application Service ,
46+
app_instance , Application Instance ,
47+
process_id , Process ID ,
48+
49+
vtap , DeepFlow Agent , Deprecated,please use agent.
50+
agent , DeepFlow Agent ,
51+
52+
profile_event_type , 剖析类型 ,
53+
profile_language_type , 语言类型 ,

server/querier/engine/clickhouse/clickhouse.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,12 @@ func (e *CHEngine) TransFrom(froms sqlparser.TableExprs) error {
13191319
newDB = fmt.Sprintf("%04d_%s", orgIDInt, e.DB)
13201320
}
13211321
}
1322+
1323+
// profile.in_process_metrics.1s
1324+
if e.Table == chCommon.TABLE_NAME_IN_PROCESS_METRICS {
1325+
e.DataSource = "1s"
1326+
}
1327+
13221328
if e.DataSource != "" {
13231329
e.AddTable(fmt.Sprintf("%s.`%s.%s`", newDB, table, e.DataSource))
13241330
} else {

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ const TABLE_NAME_SPAN_WITH_TRACE_ID = "span_with_trace_id"
3434
const TABLE_NAME_L7_FLOW_LOG = "l7_flow_log"
3535
const TABLE_NAME_EVENT = "event"
3636
const TABLE_NAME_FILE_EVENT = "file_event"
37+
const TABLE_NAME_IN_PROCESS = "in_process"
38+
const TABLE_NAME_IN_PROCESS_METRICS = "in_process_metrics"
3739
const IndexTypeIncremetalId = "incremental-id"
3840
const FormatHex = "hex"
3941
const TagServerChPrefix = "服务端"
@@ -57,7 +59,7 @@ var DB_TABLE_MAP = map[string][]string{
5759
DB_NAME_DEEPFLOW_ADMIN: []string{"deepflow_server"},
5860
DB_NAME_DEEPFLOW_TENANT: []string{"deepflow_collector"},
5961
DB_NAME_EVENT: []string{"event", "file_event", "alert_event"},
60-
DB_NAME_PROFILE: []string{"in_process"},
62+
DB_NAME_PROFILE: []string{"in_process", TABLE_NAME_IN_PROCESS_METRICS},
6163
DB_NAME_PROMETHEUS: []string{"samples"},
6264
DB_NAME_APPLICATION_LOG: []string{"log"},
6365
}

server/querier/engine/clickhouse/metrics/metrics.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ func GetMetricsByDBTableStatic(db string, table string) map[string]*Metrics {
350350
}
351351
case ckcommon.DB_NAME_PROFILE:
352352
switch table {
353-
case "in_process":
353+
case "in_process", ckcommon.TABLE_NAME_IN_PROCESS_METRICS:
354354
return GetInProcessMetrics()
355355
}
356356
case ckcommon.DB_NAME_APPLICATION_LOG:
@@ -664,7 +664,7 @@ func MergeMetrics(db string, table string, loadMetrics map[string]*Metrics) erro
664664
}
665665
case ckcommon.DB_NAME_PROFILE:
666666
switch table {
667-
case "in_process":
667+
case "in_process", ckcommon.TABLE_NAME_IN_PROCESS_METRICS:
668668
metrics = IN_PROCESS_METRICS
669669
replaceMetrics = IN_PROCESS_METRICS_REPLACE
670670
}

server/querier/engine/clickhouse/tag/description.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ func GetStaticTagDescriptions(db, table string) (response *common.Result, err er
768768
}
769769
}
770770

771-
if slices.Contains([]string{ckcommon.DB_NAME_EXT_METRICS, ckcommon.DB_NAME_DEEPFLOW_ADMIN, ckcommon.DB_NAME_DEEPFLOW_TENANT, ckcommon.DB_NAME_PROFILE, ckcommon.DB_NAME_PROMETHEUS}, db) {
771+
if slices.Contains([]string{ckcommon.DB_NAME_EXT_METRICS, ckcommon.DB_NAME_DEEPFLOW_ADMIN, ckcommon.DB_NAME_DEEPFLOW_TENANT, ckcommon.DB_NAME_PROMETHEUS}, db) || table == ckcommon.TABLE_NAME_IN_PROCESS {
772772
response.Values = append(response.Values, []interface{}{
773773
"tag", "tag", "tag", "tag", "tag", "tag", "map",
774774
"Native Tag", []string{}, []bool{true, true, true}, "tag", "tag", "tag", "", false, []string{}, "",
@@ -936,7 +936,7 @@ func GetDynamicTagDescriptions(db, table, rawSql, queryCacheTTL, orgID string, u
936936
}
937937

938938
// 查询外部字段
939-
if !slices.Contains([]string{ckcommon.DB_NAME_EXT_METRICS, ckcommon.DB_NAME_FLOW_LOG, ckcommon.DB_NAME_DEEPFLOW_ADMIN, ckcommon.DB_NAME_DEEPFLOW_TENANT, ckcommon.DB_NAME_EVENT, ckcommon.DB_NAME_PROMETHEUS, ckcommon.DB_NAME_APPLICATION_LOG, "_prometheus"}, db) || (db == "flow_log" && table != "l7_flow_log") {
939+
if !slices.Contains([]string{ckcommon.DB_NAME_EXT_METRICS, ckcommon.DB_NAME_FLOW_LOG, ckcommon.DB_NAME_DEEPFLOW_ADMIN, ckcommon.DB_NAME_DEEPFLOW_TENANT, ckcommon.DB_NAME_EVENT, ckcommon.DB_NAME_PROMETHEUS, ckcommon.DB_NAME_APPLICATION_LOG, "_prometheus"}, db) || (db == "flow_log" && table != "l7_flow_log") || (db == ckcommon.DB_NAME_PROFILE && table != ckcommon.TABLE_NAME_IN_PROCESS) {
940940
return response, nil
941941
}
942942
externalChClient := client.Client{

0 commit comments

Comments
 (0)