Compute age of data

made a small custom Telegraf plugin. It makes DNS queries for a domain DNSKEY records. (Domain must be DNSSEC signed.) *It then saves the result to influx with the query_time_ms as field and domain,algorithm, keytag as tags.

What I would like to do is to calculate the age of every key. And in theory it is very simple.
Take the first time we saved a key (identified by domain,algorithm, keytag) to influx, subtract the timestamp from the current timestamp and save the result to a new measurement in influx.

I just have not been able to come up with a method to do it, besides writing my own go program but I’d rather like to solve it with the tools of the tick stack.

Please! Any suggestions are welcome!