Capture and replicate tag in all of the metrics

Dear community,

I am using win_perf_counters to capture the basic information about my OS. At the same time, I would like to complement the metric with a new tag called IP with the data comming from “ipconfig” command. What I am doing today, and it is working, it to launch exec plugin, executing a cmd script every 8h and sending the data to a txt file that is consumed and stored as a tag by inputs.file telegraf.
It works perfectly, nevertheless, I would like to know if there is a way to optimize it in another way because I will have a similar approach in the comming future where I need to contextualize all the metrics comming from inputs.mqtt with another message comming from another inputs.mqtt.

Thanks in advance

The only other way I can think of doing this is using the exec processor, rather than an exec input. This way you don’t need to combine things, but can apply it directly to the metric you care about.

As far as your MQTT scenario, we make no guarantees about ordering of metrics. So while you could use the starlark processor to store info about one metric and use it for later metrics, there is no guarantee that the next metric is the metric you want to add information to.