有可能将两个提示符的结果连接起来吗?



下面两个提示的结果将具有相同的标签。
1。按(工作负载)求和(label_replace(kube_replicaset_status_replicas{},"workload","$1","replicaset" (.+)"))2.按(工作负载)求和(label_replace(kube_statefulset_replicas{},"workload","$1","statefulset","(.+)"))

交货)

  1. sum by(workload) (label_replace(kube_replicaset_status_replicas{},"workload","$1","replicaset" (.+)"))
{
"metric": {
"workload": "zmx"
},
"value": [
1669274927.023,
"0"
]
},{
"metric": {
"workload": "efg"
},
"value": [
1669274927.023,
"0"
]
}  
  1. sum by(workload) (label_replace(kube_statefulset_replicas{},"workload","$1","statefulset","(.+)"))
{
"metric": {
"workload": "abc"
},
"value": [
1669274927.023,
"0"
]
},{
"metric": {
"workload": "efg"
},
"value": [
1669274927.023,
"0"
]
}  

连接如下所示

{
"metric": {
"workload": "abc"
},
"value": [
1669274927.023,
"0"
]
},{
"metric": {
"workload": "efg"
},
"value": [
1669274927.023,
"0"
]
},{
"metric": {
"workload": "zmx"
},
"value": [
1669274927.023,
"0"
]
},{
"metric": {
"workload": "efg"
},
"value": [
1669274927.023,
"0"
]
}  

我可以从一个提示符直接得到上面的结果吗?

尝试使用"或"接线员:

sum by(workload) (label_replace(kube_replicaset_status_replicas{},"workload","$1","replicaset","(.+)")) or sum by(workload) (label_replace(kube_statefulset_replicas{},"workload","$1","statefulset","(.+)"))

相关内容

  • 没有找到相关文章