英文:
Apply prometheus metric for specific deployment
问题
这个指标返回特定 Pod 的运行时间:
sum by(namespace, pod) (
(
last_over_time(kube_pod_completion_time[1d])
- last_over_time(kube_pod_created{pod="consumer-deployment-697bcc9d8-sl9lj"}[1d])
)
or
(
time() - kube_pod_created{pod="consumer-deployment-697bcc9d8-sl9lj"}
)
)
这个代码片段返回所有的 Pod,如何使它只返回特定部署的结果?
英文:
This metrics return the runnig time of specific pod
sum by(namespace, pod) (
(last_over_time(kube_pod_completion_time[1d])
- last_over_time(kube_pod_created{pod="consumer-deployment-697bcc9d8-sl9lj"}[1d]))
or
(time() - kube_pod_created{pod="consumer-deployment-697bcc9d8-sl9lj"})
)
and this
kube_pod_created{})
return all pods how can I make it retrun only result from specific deployment ?
答案1
得分: 0
我找到了一个对我有用的解决方案,我已经添加了以下内容:
pod=~"consumer-deployment.*"
所以它只列出以该前缀开头的Pod。
最终查询是:
kube_pod_created{pod=~"consumer-deployment.*"}
英文:
I'v found a solution that worked for me I'v added
pod=~"consumer-deployment.*"
so it list only pods start with that prefix
final query is
kube_pod_created{pod=~"consumer-deployment.*"}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论