Hi, anybody knows what transformation I could use in order to make a small regex and get only the version
(part after :
) of the docker images? kube_pod_container_info{namespace="$namespace"}
I would like to have a column only with the version. Messed around but didn’t got anything working.
~what kind of datasource is this?~ prometheus :woman-facepalming:
you could use promQL for that with label_replace function
label_replace(kube_pod_container_info{namespace="$namespace"}, "version", "$2", "image", "(.*):(.*)")
this works with such a syntax:
label_replace(<vector>, <desired label name>, <regex element>, <original label>, <regex>)
where regex element is the pointer to .* - at least that’s how I understand that
also, if you want strict Grafana version without modyfing the qeury (and you don’t plan to do further transformations), you could use Value Mappings on image column. But that wouldn’t change the data just the display, so you wouldn’t be able to go with next transformations, therefore, imo promql approach is better here (considering version is always after : )
wow, works like a charm!
Tried with label_replace but failed so I gave up on it, however it seems it was the right way. Thank you!