处理Prometheus监控取值为+Inf
pod_memory_use表达式:
sum (container_memory_working_set_bytes{container !="",container!="POD"}) by (container, pod) / sum(container_spec_memory_limit_bytes{container !="",container!="POD"}) by (container, pod) * 100
说明:
!=+Inf
过滤正无穷的数据,如果容器没有定义限制内存,测container_spec_memory_limit_bytes值是0;
优化后的ProSQL公式:
sum (container_memory_working_set_bytes{container !="",container!="POD"}) by (container, pod) / sum(container_spec_memory_limit_bytes{container !="",container!="POD"}) by (container, pod) * 100 !=+Inf