How to set up the custom tags for multi-value in Grafana?

I have a variable of type that takes the query

SHOW TAG VALUES FROM "transactions_per_minute" WITH KEY = "product_type"

There are around 10 values from that query and I would like to group them up by tags depending on the values just like what this demo shows grafana can do.

I’ve tried to look for simple of guides but can’t seem to find any(One of the docs I’ve tried) I’m quite a newbie in this so could someone elaborate more on what i should fill in the Tags Query and Tags Value Query if I would like to create a tag named Foo that consists of 5-7 values taken from the above query?

Any help would be greatly appreciated. :))
Grafana version: 4.6.5
Source: influxdb

I’ve posted a more comprehensive question on the following thread

I would not recommend using this feature as it is likely to be removed in the future

1 Like

Hi @torkel, thanks for the reply. would you happen to know any better alternatives for the multi-value tags? and if I may ask, why would it be removed in the future? it seems like a great feature to have.

Having a multi-value tags feature would make using grafana much easier as users won’t have to click multiple check boxes just to filter the graph the way they want it.

@rickyarkan I’m not 100% if this would fit your use case, but we do the following:

Firstly, let’s say we have a set of Influx tags like the following:

  • a site tag, with values like 1, 2, 3
  • a system tag, with values like 1a, 1b, 1c, 2a, 2b, 2c, 3a, etc.
    Basically, each site will have a number of systems that are at that site.

We then have two template variables:

  • $site_filter, which is of type Query, with values from the following query:

Here data is of course the measurement name; and

  • $system_filter, which is again of type Query, based on the following:
SHOW TAG VALUES FROM "data" WITH KEY="system" WHERE "site" =~ /^$site_filter$/

Now, importantly (at least for this example), “Multi-value” and “Include All option” should be ticked, and the “Custom all value” should be left blank (auto). [This works well if the number of systems is reasonably modest. If it’s large (e.g. hundreds), then there’s another approach that works better.]

The result, in terms of UI for the template variables, is you’ll get a Site drop-down and a System drop-down. If you select a site in the site drop-down, you’ll get all the available systems for that site in the systems drop-down. You can select any or all of those systems (and if you desire you can select multiple sites also).

Finally, the queries for the actual charts will look like

SELECT * FROM "data" WHERE "system" =~ /^$system_filter$/

Since we did not define the “Custom all value”, the $system_filter will expand to either (a) all the individually selected systems, or (b) all the systems for all selected sites. Which should generally get you the data corresponding to the drop-downs.

This should be reasonably straightforward from a UI perspective, without relying on the (experimental?) value groups/tags functionality.

1 Like

Hi @Svetb, thanks a lot for the help, I really appreciate it :smile:!

I have set up something similar that uses product_type, payment_type and 10 other tags to let users be able to filter the data as they please. However, the reason I wanted to add a multi-value tag was because the product_type has grown into a lot of values (it’s actually somewhere close to 30) and users are required to tick almost 15-25 product_type values every time they want to get that certain data that they want.

In addition, adding a new tag for the multi-value Foo as a new, 13th, dropdown instead of the experimental tag would require me to rerun and backfill the entirety of the data; which I’m hoping to avoid.

Following your advice seems like the only reasonable options left, would you happen to know of any other way to show something of a similar nature?

1 Like