Hello,

On Mon, 1 Feb 2021, Nabil L. wrote:

Any help ? :)

maybe:

sum without (image) (label_replace(kube_pod_container_info, "release", "$1", "image", 
".*:([^:]*)"))

Regards,
Matthias


Le lundi 1 février 2021 à 21:10:14 UTC+1, Nabil L. a écrit :

Hi Folks,

I wonder if someone know how to extract a string from a label_value  and
using the the label_replace .

For example I have the following metric, which return

*kube_pod_container_info* which return the following metric:

{container="d2conf",
container_id="docker://9e9fdd34fa960000abbf309c279a19fcae828646a7b11169292c7da05e3349c9",
image_id="docker-pullable://docker-registry/toto-jx/deploy-ws@sha256:d6c2db22b2b677a7c6017d6f3eeb4055750750349a48b716d6215721ccce1aa8",
instance="kube-state-metrics.kube-system.svc.cluster.local:8080",
job="kube-state-metrics", namespace="toto", pod="d2conf-1",
image="docker-registry/toto/deploy-ws:1.4.2"}

Using  the label_replace, the label *image *is replaced by *release*, but
what I need as well is to extract the string after character "*:*" in the
label value (below in yellow)

sum without (image) (label_replace(kube_pod_container_info, "release",
"$1", "image", "(.*)"))


{container="d2conf",
container_id="docker://9e9fdd34fa960000abbf309c279a19fcae828646a7b11169292c7da05e3349c9",
image_id="docker-pullable://docker-registry/toto-jx/deploy-ws@sha256:d6c2db22b2b677a7c6017d6f3eeb4055750750349a48b716d6215721ccce1aa8",
instance="kube-state-metrics.kube-system.svc.cluster.local:8080",
job="kube-state-metrics", namespace="toto", pod="d2conf-1", *release*
="docker-registry/toto/deploy-ws:1.4.2"}


any idea?

Thanks in advance
Neb.


--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/4acbe3b4-a5c3-4655-adf6-53b0e8b15fe4n%40googlegroups.com.



--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/8e67452-9fb-b93e-b61c-804b5632ca1d%40zu-con.org.

Reply via email to