Similar labels are coming from this popular package -> prom-client
Update
After struggling for a couple of hours reading how to do it , it finally worked.
It was already explained at least a couple of times.
In my case to get it display v9.4.0 into Singlestat Panel from nodejs_version_info{group=“axsportal”,instance=“localhost:6600”,job=“prometheus”,major=“9”,minor=“4”,patch=“0”,version=“v9.4.0”} 1
I had to go to
Data sources make sure I have Scrape interval set to : 60s
In my dashboard Add row -> SingleStat -> Metrics tab -> Query is : nodejs_version_info , now value displayed is 1
SingleStat -> Options -> Value Stat (name)
Go back to SingleStat Metrics -> Legend format {{version}} You can pick any label of the nodejs_version_info query.
;tldr You can make columns a type of “hidden” on the column style page, you just regex away everything you don’t want or hide one by one. Or you just use max(metric) by (LabelICareAbout,LableICareAbout)
Using Grafana Version: v5.2.1
I created an account just to respond to this because I too spent a bunch of time on this and the answer ended up being pretty easy.
I think this is what you are trying to do
Okay you go into Prometheus and you query a single metric in my case kube_node_info. If that is all you query you get a bunch of columns back. I added line breaks below, in reality this is just a single long string. Now in my case (and I think your case) you just want a few of these, one, maybe two in a table. I want to have a table that is just Kernel version, node, name, and OS image.
If you put just the metric in it looks gross, I don’t want all those columns.
I would put an image here of how that looks but but I'm a *new user* and *new users* only get 2 photos per post.
Solutions
There’s two ways I found to get what you want.
Use aggregation: I only care about the most recent reading so first thing is to check the “Instant”. Then you do max(metric) by (LabelICareAbout,LableICareAbout)
The other way is to use column style page and regex out the columns you don’t want. In this one my query is just kube_node_info no max or group, with instant checked (or without up to you). On the Column styles tab I enter \b(?!node|kernel_version|os_image)\b\S+1 for the "apply to columns named field. And specify the type to “Hidden”. Picture is probably easier to see what is going on. I also added a few other column styles to make the names pretty.
1 I don’t know regex and never will. If you don’t just google “regex everything that isn’t” or something similar to get the regex to regex everything else away.
Hi, as we know singlestats is deprecated and will no longer available in Grafana 7.0, instead we have to use Stats panel. Do we have any clue how to do similar in Stats panel? Thx. @dimitardanev