SHOW TAG VALUES shows no records

Hi! I have a problem with SHOW TAG VALUES which shows no records :disappointed:
My data looks like this

> show series
key
---
mqtt_consumer,host=ploter,topic=tele/temp1/SENSOR
mqtt_consumer,host=ploter,topic=tele/temp2/SENSOR
> show measurements
name: measurements
name
----
mqtt_consumer
> select * from mqtt_consumer
name: mqtt_consumer
time                AM2301_DewPoint AM2301_Humidity AM2301_Temperature host   topic
----                --------------- --------------- ------------------ ----   -----
1642969842839118371 10.3            45.7            22.6               ploter tele/temp2/SENSOR
1642969845438157479 10.9            43.4            24.1               ploter tele/temp1/SENSOR
1642969852853777919 10.3            45.7            22.6               ploter tele/temp2/SENSOR
1642969855449937226 10.7            43.3            24                 ploter tele/temp1/SENSOR
> show tag keys
name: mqtt_consumer
tagKey
------
host
topic
> show tag values with key = "topic"
NOTHING :(
> show tag values with key = "host"
NOTHING :(

My config is

[global_tags]
[agent]
  interval = "10s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = ""
  debug = true
  quiet = false
  logtarget = "file"
  logfile = "/var/log/telegraf/logfile"
  logfile_rotation_max_size = "10MB"
  hostname = ""
  omit_hostname = false
[[outputs.influxdb]]
  urls = ["http://127.0.0.1:8086"]
  database = "sensors"
  username = "xxx"
  password = "xxx"
[[outputs.file]]
  files = ["stdout", "/tmp/metrics.out"]
[[inputs.mqtt_consumer]]
  servers = ["tcp://127.0.0.1:1883"]
  topics = ["tele/+/SENSOR"]
  data_format = "json"

Generaly I have problem with Grafana dashboard.
When I create new panel and start adding new query when I click “+” button after WHERE clause I can choose a KEY (host/topic) but when I am trying to point specific topic (select tag value) i have noting but “No options found” on the list.
In a moment of selecting specific topic, Grafana sends below query to InfluxDB http connector

"GET /query?db=sensors&epoch=ms&q=SHOW+TAG+VALUES+FROM+%22mqtt_consum
er%22+WITH+KEY+%3D+%22topic%22 HTTP/1.1" 200 57 "-" "Grafana/8.3.4" fa0444dd-7c89-11ec-8287-000000000000 1204

And it gets empty response (the same as my manual influx query above)

When I cannot select topic, I can’t distinguish between sensors and I have all temperature measurement in one series of data (I want to plot every temperature sensor separatly).

The fun thing is, that where I manually prepare query in Grafana, it is working fine (data is returned by influxdb datasource)
SELECT mean("AM2301_Humidity") FROM "mqtt_consumer" WHERE topic = 'tele/temp1/SENSOR' AND $timeFilter GROUP BY time($__interval) fill(null)
A spent whole weekend to figure it out but without luck :disappointed:

HOW to force
> show tag values with key = "topic"
TO return proper data?

HELP!? ANY ONE? :smile:
THANKS!!!

1.Possible bug
Which version of InflxDB are you using? in some old versions, this was a rare bug (without a solution).

2.Wrong/missing serialization
From your telegraf config, I see no mapping for tags, this usually means that everything is mapped as a field, see:

it’s pretty easy to see, just have a look at the line protocol you get, either run Telegraf with --test, or look at your output_file since by default it uses lineprotocol

3.duplicate names
Another idea I have is that something bad happened and that name is used both as a tag and a field key (in theory this cannot happen… but once I ended up in this situation), and the engine is now confused about which one to reference… this rarely happens and leaves behind errors in the log so it shouldn’t be that hard to spot… (just run a SHOW FIELD KEYS)…

Version! That’s was the problem. I was using influxdb 1.6.4-1build1 from Ubuntu 20.04.3 LTS repository.
When I switched to InfluxDB2 everything woks fine :smiley:
THANKS!