...或“如何count_over_time
工作?”
给定以下向量和值:
kube_job_created{
app="prometheus",
chart="prometheus-7.1.0",
component="kube-state-metrics",
heritage="Tiller",
instance="100.96.2.23:8080",
job="kubernetes-service-endpoints",
job_name="foobar-24150",
kubernetes_name="prometheus-kube-state-metrics",
kubernetes_namespace="devops",
namespace="devops",
nodename="ip-1-1-1-1.ap-southeast-2.compute.internal",
release="prometheus"
} 1538008393
计算整个向量返回1
:
count(kube_job_created{app="prometheus",chart="prometheus-7.1.0",component="kube-state-metrics",heritage="Tiller",instance="100.96.2.23:8080",job="kubernetes-service-endpoints",job_name="braze-user-attribute-sync-24150",kubernetes_name="prometheus-kube-state-metrics",kubernetes_namespace="devops",namespace="devops",nodename="ip-10-10-4-112.ap-southeast-2.compute.internal",release="prometheus"})
结果:
{} 1
现在,count_over_time
它根据范围矢量选择器而有所不同:
1米:
count_over_time(kube_job_created{app="prometheus",chart="prometheus-7.1.0",component="kube-state-metrics",heritage="Tiller",instance="100.96.2.23:8080",job="kubernetes-service-endpoints",job_name="braze-user-attribute-sync-24150",kubernetes_name="prometheus-kube-state-metrics",kubernetes_namespace="devops",namespace="devops",nodename="ip-10-10-4-112.ap-southeast-2.compute.internal",release="prometheus"}[1m])
结果是“2”:
{app="prometheus",chart="prometheus-7.1.0",component="kube-state-metrics",heritage="Tiller",instance="100.96.2.23:8080",job="kubernetes-service-endpoints",job_name="braze-user-attribute-sync-24150",kubernetes_name="prometheus-kube-state-metrics",kubernetes_namespace="devops",namespace="devops",nodename="ip-10-10-4-112.ap-southeast-2.compute.internal",release="prometheus"} 2
- 1h 返回 120
- 24小时返回2880
随着时间的推移,它到底在计算什么?