Closed TakumaNakagame closed 5 years ago
Hi @TakumaNakagame,
I disagree to separate each tags as labels.
Please see https://github.com/prometheus/consul_exporter/issues/45#issuecomment-296429261.
No, this label shouldn't be added to all metrics:
- Joins work fine here, it's not sane to replicate the same information over and over
- Tags are not necessarily immutable, which would create new time series every time any label gets updated
- Labels come at a cost, the more are added the more elaborate aggregations become. As not every query requires a tag label matcher, I don't agree to make such queries harder.
This comment has been made on another type issue, but I think it can fit to this issue as well.
In your case, you can use a regex-matcher like following:
sakuracloud_server_info{tags=~".*,instance-type=worker,.*"}
You can also use with multiple matcher like following:
sakuracloud_server_info{tags=~".*,instance-type=worker,.*",tags=~".*,@group=a,.*"}
Hi @yamamoto-febc, Thank you for confirmation!
I didn't know this. Thank you for teaching me. Did not know that you can use multiple matchers! This will solve.
I was saved. This issue will be closed. Thank you as always.
Problem
I want to group with PromQL using "tags". However, grouping is not possible because all tags are grouped in "tags".
Example
There is the following environment.
I want to group by "instance-type". However, tags cannot be grouped by "@gorup" tag. This can be done by grouping with the combination of
{tags="@auto-reboot,@instance-type=master,k8s-node"}
.Feature
For example, we want to create a label like this:
In this case, grouping can be done with the following PromQL This gives you the total number of servers for each instance type.