Override field name for "auto_x" fallback #15949
Labels
feature request
Requests for new plugin and for new features to existing plugins
waiting for response
waiting for response from contributor
Use Case
I'm running a
tig
-stack with threemqtt_consumer
s writing into theinfluxdb
. There are many topics with different data types flowing into telegraf (float, dict, string). Lately, I was searching days for an error introduced by the datatype "auto_float". As telegraf is outputting into influxdb, I thought, letting telegraf write to afloat
fieldType
is safe (as influxdb doesn't allow forfieldType
conversion). But, during backup a script is stopping and restarting influxdb for the sake of consistency. I had to learn by hard, that if the first value telegraf writes to this measurement after restart, is of typestring
(resulting from failingauto_float
conversion), influxdb would allow to write and change thefieldType
fromfloat
tostring
, leading to a big mess later on.What if telegraf could automatically override the field name to some configured value (i.e.
value_string
), if it falls back tostring
due to failing auto conversion? There could be some additional config key tovalue_field_name
, likevalue_field_fallback_name
.Expected behavior
Upon input value, which can be converted to
auto_x
(like55
or"5.5"
forauto_float
), the metric gets output to the configuredvalue_field_name
.Upon input value, which fails in conversion (like
"yyy"
), the metric gets output to the configured fallback field_name (likevalue_string
).Actual behavior
Like described in documentation, the value get's written as string on fallback. When using
float
and the conversion fails, there will be an error and there is not output.Additional info
The
auto_x
was introduced with #13506.The text was updated successfully, but these errors were encountered: