Creating a plugin to change the Measurement name of InfluxDB data dource

I would like to use InfluxDB as a data source where the Measurement names are all numbers.
At this time, it is difficult to know what items represent, so I would like to change the display of the item names using the mapping between numbers and item names that I have in another database.

The measurement name in InfluxDB is determined by another system and cannot be changed.
Can I create my own plugin that does this?

@ritsu2891 this might be a case where you want to contribute to the influxdb datasource plugin (which is part of the grafana).

Grafana’s plugin API doesn’t support plugins modifying the behaviour of other plugins.

1 Like

Thank you for your kind reply.
I did some research on my own and found that it is not possible to change the behavior of the Grafana native InfluxDB plugin with a plugin.
Since I need to address the above immediately, I decided to first create my own InfluxDB data source as a plugin that allows me to change the item names as described above.

1 Like

I am confident it’ll take you less time to open a PR in grafana than recreate all the influxdb plugin functionality. You should give it a try.

1 Like

Also, just to add my $0.02, if one were using Flux (which @ritsu2891 does not appear to be using), I believe you could rename the measurement in your Flux query using the map() function to modify the _measurement field in the results. Something like this:

from(bucket: "your_bucket_name")
  |> range(start: -1h) // Adjust the time range as needed
  |> filter(fn: (r) => r._measurement == "74059804712109356")
  |> map(fn: (r) => ({ r with _measurement: "Item_A" }))

1 Like

Hi, I wonder how you’ve done it? I actually need this too.

Regards,
Henjod

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.