How to merge resulting series by dropping labels?

1,137 views
Skip to first unread message

aram.a...@gmail.com

unread,
Mar 13, 2018, 3:41:48 AM3/13/18
to Prometheus Users
Suppose by running "kube_pod_completion_time - kube_pod_start_time" query we get these series:

ElementValue
{instance="kube-state-metrics:8080",job="kube-state-metrics",namespace="my-namespace",pod="my-app-12-build"}119
{instance="kube-state-metrics:8080",job="kube-state-metrics",namespace="my-namespace",pod="my-app-12-deploy"}615
{instance="kube-state-metrics:8080",job="kube-state-metrics",namespace="my-namespace",pod="my-app-9-build"}586


How can we merge these series into one ignoring pod label) so we can graph pod lifetimes over time?

I have tried these but with no luck:

* Using label_replace to drop:
label_replace(kube_pod_completion_time - kube_pod_start_time, "pod", "", "pod", ".*")

Error executing query: duplicated label set in output of label_replace(): {app="kube-state-metrics", exported_namespace="my-namespace", instance="10.130.0.161:8080", job="service-endpoints", namespace="monitoring", service_name="kube-state-metrics"}

* and many combinations of without(pod) and ignoring(pod) but those didn't work as well.

Brian Brazil

unread,
Mar 13, 2018, 3:54:17 AM3/13/18
to aram.a...@gmail.com, Prometheus Users
You want aggregation, so avg without(pod)(kube_pod_completion_time - kube_pod_start_time)

Brian
 

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-users+unsubscribe@googlegroups.com.
To post to this group, send email to prometheus-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/110b25bb-8ddf-4a15-8259-9acb32c32e3b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages