Best way to visualize number of distinct tags over time?

Hello All,

I have a network of sensors passing data to influxdb. Each sensor has a unique ID, used as a tag in Influx.

Updated for clarity
I have one tag key defined (confusingly called “tag”) and each sensor ID is a tag value.

Here’s some sample data that shows the structure:

time - - - - - - - - - - - - - - Battery ValueA ValueB ValueC tag

1608896450000000000 90 38.62 60 101.19 00C5
1608896451000000000 90 39.35 62 101.19 00C6
1608896451000000000 90 38.62 11 102.13 00C5
1608896451000000000 90 41.15 37 101.28 00Cb

If I’ve understood the terminology properly, the sensor IDs are tag values and the rest are measurements.

Let’s say we start with 100 sensors (and therefore 100 different tags). Over time, some sensors get damaged, unplugged or otherwise incapacitated.

I have three related questions:

  1. What is the best query to use to determine the number of distinct tags in a database?
  2. Is is possible to query the number of tags that have reported data within a given time range?
  3. Is it possible to create a chart in Grafana that shows how many distinct tags are reporting data over time?

All suggestions welcome.