How to add a tag on the fly

Hello
applications them self do not know in which stage (DEV, QA, Prod … ) they run. Currently the applications send their data as JSON to telegraf/influxDB.
One option is to have the application detect the stage and send this as part of the payload to the telegraf/influxDB
An other would be to have the application send the payload and append a tag e.g.: stage=qa on the fly.
I could image the processor plugin to do this. But unfortunately I did not find at any place a possibility to do something like this.
Does any one know how I can archive this goal?
Thanks a lot for any hint
Michael

If you have a telegraf service for each environment you can use the “global tags”

[global_tags]
  user = "me"

I personally prefer the idea of adding some logic in the source, this way the conf file is “cleaner” and does not include logic.
This way if different environments share the same configuration (except for the connections) you can distribute the conf file without worrying about the static tags or any other fixed logic that has been added in each file