Telegraf or Influxdb flux query which to update

Hi. I am having a new requirement to add a new tag based on pre-existing tag and include that in flux query calculation. So one option can be using influxdb flux library and take the substring and process it in the query or second would been to add new tag through telegraf. I wanted to know which way would be better for both current and future updates.

Hi @Pratik_Das_Baghel,
Could you provide an example of the data you are hoping to generate a new tag from? Is the tag only required within this query or should it be saved for future queries against the data set?

Hi. So i am having set of tasks plus historical queries to run if any task fails to run or data is missing. So we are getting software version for data. Currently version was 6.0.xxx and now major software update has come which will be 6.5.xxx. So in task calculation from now on we have to include new tag (cell) in calculation for 6.5.xxx and for future updates.

So we have decided that we should a new tag which will be substring for software version say for 6.0.xxx it will be 6.0 and for 6.5.xxx it will be 6.5. So for this to add in my current task i have to include an additional map function as shown in query below along with their total execution time as measured by flux profiler

//Current query for 6.0.xxx 
from(bucket: src_bucket)
        |> range(start: start_time, stop: stop_time)
        |> filter(fn: (r) => r["_measurement"] == src_measurement)
        |> filter(fn: (r) => r["_field"] == field_name )
        |> group(columns: [some tags])
        |> sum()
//profiler - 830583352

//New query for 6.0.xxx
from(bucket: src_bucket)
        |> range(start: start_time, stop: stop_time)
        |> filter(fn: (r) => r["_measurement"] == src_measurement)
        |> filter(fn: (r) => r["_field"] == field_name )
        |> map(fn: (r) => ({r with Version: strings.substring(v: r.Version, start: 0, end: 3)}))
        |> group(columns: [some tags,"Version"])
        |> sum()
//profiler - 1015248080

So i have add an additional map function to get the Version.
This Version tag we will be adding for current 6.0.xxx setup and for upcoming setups so to have consistency in grafana query.