Add new tags in continuous query

Hi!

I have a use case where I would like to add a new tag when running a continuous query. I know how to insert all existing tags, but is it possible to introduce another tag to all values? I can’t figure it out based on the documentation, and everything I can come up with fails.

Thanks!

Hello @teunvink,
Welcome and thanks for this question. Unfortunately, that’s not possible. The only way to insert a tag into an existing series would be through reinserting the series. People use either Kapacitor or a Client to do this.

Thanks for the reply. A client would be too costly, since we’re talking about a fair number of measurements per second. I’ll take a look at Kapacitor then.

Should someone be running into this problem, here’s a simplified version of the tick script I’m using:

dbrp "db"."retentionpolicy"
  
stream
    |from()
        .measurement('mymeasurement')
    |influxDBOut()
        .database('db')
        .measurement('anothermeasurement')
        .tag('key', 'value')

The only downside to this is that there are two measurements now, so you need to put some effort into deleting the original measurement.