I was doing some routing in telegraf and noticed that the tags option on processors does not get applied.
The TOML parser throws no error on the tags entry but it does not get applied. Some research with Claude pointed out that only inputs and aggregators plugins have a tags option. I assume because they both create new metrics.
Is this correct and why is this not implemented in every plugin-type?
[[processors.starlark]]
alias = "Extract bits"
order = 1
script = "${TELEGRAF_HOME}/telegraf.d/processors/starlark.bitExtraction.star"
log_level = "info"
[processors.starlark.tags]
_skip_something = "true"
A processor just edits the data that you collected through and input. So what input are you using to collect the data before it goes to starlark and does it show the tag before going to the processor?
The inputs used are not really relevant. I wanted to add tags along the way, I use tags as internal variables that move with the metric. These tags are filtered out at the outputs.
I am just wondering if or why it is limited to inputs and aggregators.
How are you bringing traffic into Telegraf to then use a processor if you are not using an input? I definitely get the idea of wanting to add tags along the way but you somehow have to bring the traffic in first to be processed.
I use multiple inputs (opcua_listener, MQTT, modbus, mock,…) and they all get routed through some processors to align their behavior.
The main reason for my question is that I wanted to add a tag to a metric for debugging purposes at the time. Instead of adding them in the Starlark script, I wanted to do this in the configuration of the processor. Starlark has the option to add a tag in code, but all other processors don’t have this option. So you can’t really add a reliable way to mark these metrics to see whether they were processed or skipped. You would have to add a defaults processor in line with the same pass and drop filters as the processor you want to mark.
So, to reiterate on my question, why is this not an option for all processors? Actually, even outputs could have tags if every plugin gets a synchronized configuration.
[processors.starlark.tags]
_mark_processed= "true"