@jangaraj - your workaround was brilliant. Thanks. It worked like a charm when I mapped the original and translated values in a 1:1 fashion. But, things broke down when I attempted to do one of two things (sorry, I didn’t know these use cases until I had your workaround )
- map a wild card value, e.g. an All function, or
- map 1:n values
I’m going to focus only on the “All” function here, as that will solve my issue. Here is my test case:
a.) build translate table in InfluxDB, with two tags, “xlat” and “orig”
My intention is that the tag “xlat” is the translated value that the user sees, and the tag “orig” is the value that is passed to InfluxDB.
[~]$ influx -database my_database
Connected to http://localhost:8086 version 1.6.3
InfluxDB shell version: 1.6.3
> drop measurement xlat_partner_to_prod
> insert xlat_partner_to_prod,orig=Partner,xlat=Production count=1 0
> insert xlat_partner_to_prod,orig=.*,xlat=All count=1 0
> select orig, xlat, count from xlat_partner_to_prod
name: xlat_partner_to_prod
time orig xlat count
---- ---- ---- -----
0 .* All 1
0 Partner Production 1
b.) template queries In Grafana (v4.6.3)
- The query for the VISIBLE field is:
$otype show tag values from xlat_partner_to_prod with key="xlat"
- The query for the HIDDEN field is:
$org_wsdl show tag values from xlat_partner_to_prod with key="orig" WHERE "xlat" =~ /$otype/
c.) dashboard testing
When I select otype of “Production”, I see the value in $org_wsdl flip to “Partner”. This is good. Here is the query emitted from Grafana:
SELECT sum("count") FROM "my_measurement" WHERE "org_wsdl" =~ /^Partner$/ AND time >= 1535903435154ms and time ...
When I select otype of “All”, I see the value in $org_wsdl flip to “.*” which LOOKS correct. But the period and the astrisk are escaped and thus invalid as a regex. Here is the query emitted from Grafana:
SELECT sum("count") FROM "my_measurement" WHERE "org_wsdl" =~ /^\.\*$/ AND time >= 1535903435154ms and time ...
Any thoughts?