Subject: | please add mechanism to force floating point interpretation |
Date: | Fri, 08 Feb 2019 10:53:42 +1000 |
To: | bug-InfluxDB-LineProtocol [...] rt.cpan.org |
From: | Alexander Zangerl <az [...] snafu.priv.at> |
feeding data2line an integral floating point value causes it to be
submitted to influx as integer.
calling InfluxDB::LineProtocol::data2line("whatever", 5.0) results
in "5i" which fails if the db had any floating point values fed to it
previously.
the source tells me that _format_value() interprets incoming trailing 'i'
markers and does ensure that influxdb gets all integers
marker-postfixed as required, but there's no clean way to disable the
logic that guesses integers.
my workaround at this moment is to feed data2line the float as string with
forced decimals, i.e. snprintf("%.1f",5), but that does feel pretty unclean;
i think adding (and documenting) an optional type marker for 'leave as float'
(e.g. trailing "f") would be a better solution.
regards
az
--
Alexander Zangerl + GPG Key 2FCCF66BB963BD5F + http://snafu.priv.at/
"The Two Phases Of University Employment:
1. Doesn't know enough to get a Real Job.
2. Knows too much to want a Real Job." -- sharks
Message body not shown because it is not plain text.