-
Notifications
You must be signed in to change notification settings - Fork 674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InfluxDB writer invalid time parsing #688
Comments
I can confirm the bug. Line https://github.com/mainflux/mainflux/blob/4f62f89b87d2c0b17819e9a6fd6f1282ca815464/writers/influxdb/messages.go#L115 simply cuts off the decimal value from the time. |
@bbokun would it be possible that you pull the fix from @dusanb94's branch, butild the docker and test it? |
@drasko @dusanb94 |
@bbokun sure, thanks! |
@bbokun We merged the fix by @dusanb94 |
@nmarcetic @drasko @dusanb94 Hi guys, Two SenML packets: [{"bt":1554424254.927,"n":"COTemperatureRead","u":"Cel","v":24.6},{"bt":1554424254.927,"n":"COTemperatureSet","u":"Cel","v":40},{"bt":1554424254.927,"n":"DHWTemperatureRead","u":"Cel","v":33.4},{"bt":1554424254.927,"n":"DHWTemperatureSet","u":"Cel","v":45},{"bt":1554424254.927,"n":"DriverStatus","v":33},{"bt":1554424254.927,"n":"FanOn","v":0},{"bt":1554424254.927,"n":"FanSpeed","u":"%","v":0},{"bt":1554424254.927,"n":"FeederOn","v":0},{"bt":1554424254.927,"n":"COPumpOn","v":0},{"bt":1554424254.927,"n":"DHWPumpOn","v":0},{"bt":1554424254.927,"n":"PumpMode","v":3},{"bt":1554424254.927,"n":"FuelLevel","v":0},{"bt":1554424254.927,"n":"FuelLevelPerc","u":"%","v":0},{"bt":1554424254.927,"n":"FuelHours","u":"s","v":0}] [{"bt":1554424255.177,"n":"COTemperatureRead","u":"Cel","v":24.6},{"bt":1554424255.177,"n":"COTemperatureSet","u":"Cel","v":40},{"bt":1554424255.177,"n":"DHWTemperatureRead","u":"Cel","v":33.4},{"bt":1554424255.177,"n":"DHWTemperatureSet","u":"Cel","v":45},{"bt":1554424255.177,"n":"DriverStatus","v":33},{"bt":1554424255.177,"n":"FanOn","v":0},{"bt":1554424255.177,"n":"FanSpeed","u":"%","v":0},{"bt":1554424255.177,"n":"FeederOn","v":0},{"bt":1554424255.177,"n":"COPumpOn","v":0},{"bt":1554424255.177,"n":"DHWPumpOn","v":0},{"bt":1554424255.177,"n":"PumpMode","v":3},{"bt":1554424255.177,"n":"FuelLevel","v":0},{"bt":1554424255.177,"n":"FuelLevelPerc","u":"%","v":0},{"bt":1554424255.177,"n":"FuelHours","u":"s","v":0}] The result in the database: name: messages 1554424254927000045 389 COPumpOn mqtt 106 0 0 1554424255177000045 389 COPumpOn mqtt 106 0 0 The milliseconds are now visible, and it is ok. The only thing is that the multiplication with 1e09 gave the expected floating values rounding issues. Thanks a lot ! |
BUG REPORT
Hello guys,
first of all - great work!
My sensors publish SenML json data via MQTT to the assigned channel. This works as expected. The data is also normalized and written into the InfluxDB via the influxdb-writer.
When I checked the data, it seems that the time is not correctly written into the database - the decimal places of the time is ignored when transforming the time into nano-seconds.
Here an example - the SenML looks as follows:
[{"bt":1554381569.992,"n":"COTemperatureRead","u":"Cel","v":34.3},{"bt":1554381569.992,"n":"COTemperatureSet","u":"Cel","v":40},{"bt":1554381569.992,"n":"DHWTemperatureRead","u":"Cel","v":36.5},{"bt":1554381569.992,"n":"DHWTemperatureSet","u":"Cel","v":45},{"bt":1554381569.992,"n":"DriverStatus","v":33},{"bt":1554381569.992,"n":"FanOn","v":0},{"bt":1554381569.992,"n":"FanSpeed","u":"%","v":0},{"bt":1554381569.992,"n":"FeederOn","v":0},{"bt":1554381569.992,"n":"COPumpOn","v":0},{"bt":1554381569.992,"n":"DHWPumpOn","v":0},{"bt":1554381569.992,"n":"PumpMode","v":3},{"bt":1554381569.992,"n":"FuelLevel","v":0},{"bt":1554381569.992,"n":"FuelLevelPerc","u":"%","v":0},{"bt":1554381569.992,"n":"FuelHours","u":"s","v":0}]
When looking into the database I get:
time channel link name protocol publisher unit updateTime value
1554381569000000000 389 COPumpOn mqtt 106 0 0
1554381569000000000 389 COTemperatureRead mqtt 106 Cel 0 34.3
1554381569000000000 389 COTemperatureSet mqtt 106 Cel 0 40
1554381569000000000 389 DHWPumpOn mqtt 106 0 0
1554381569000000000 389 DHWTemperatureRead mqtt 106 Cel 0 36.5
1554381569000000000 389 DHWTemperatureSet mqtt 106 Cel 0 45
1554381569000000000 389 DriverStatus mqtt 106 0 33
1554381569000000000 389 FanOn mqtt 106 0 0
1554381569000000000 389 FanSpeed mqtt 106 % 0 0
1554381569000000000 389 FeederOn mqtt 106 0 0
1554381569000000000 389 FuelHours mqtt 106 s 0 0
1554381569000000000 389 FuelLevel mqtt 106 0 0
1554381569000000000 389 FuelLevelPerc mqtt 106 % 0 0
1554381569000000000 389 PumpMode mqtt 106 0 3
As we see, instead of 1554381569992000000, I get 1554381569000000000, what means that the fractional part is ignored.
When I turn on the mongodb-writer, the information is stored as expected ( as 1554381569.992)
I forgot to say I use Mainflux 0.8.0
Regards,
Boris Bokun
strictit d.o.o.
Belgrade
The text was updated successfully, but these errors were encountered: