Skip to content

influxdb reports invalid number #121

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

Closed
brianmay opened this issue May 19, 2023 · 7 comments · Fixed by #123
Closed

influxdb reports invalid number #121

brianmay opened this issue May 19, 2023 · 7 comments · Fixed by #123

Comments

@brianmay
Copy link

brianmay commented May 19, 2023

After upgrading to 0.6.0 I keep getting the following error:

2023-05-19T03:56:51.245268Z ERROR brian_backend::amber: Failed to write to influxdb: InfluxDB encountered the following error: influxdb error: "{"error":"unable to parse 'amber/usage/E2 duration=30u,per_kwh=33.036441802978516,renewables=9.333999633789063,kwh=0,cost=0 1684411201000000000': invalid number"}
"

But If I downgrade to 0.5.2 it works fine. The schema in question is:

**#[derive(InfluxDbWriteable)]
struct UsageReading {
    duration: u16,
    per_kwh: f32,
    renewables: f32,
    kwh: f32,
    cost: f32,
    time: chrono::DateTime<Utc>,
}

This is with influxdb 1.10.0

@brianmay brianmay changed the title influxdb reportsd invalid number influxdb reports invalid number May 19, 2023
@brianmay
Copy link
Author

Still trying to understand how influxdb works, but seriously wondering if this has something to do with #113 and my duration field.

@brianmay
Copy link
Author

Actually, I might be getting confused. My research shows that the 'u' postfix for unsigned integers is only supported for influxdb 2.x (reference:influxdata/influxdb#17781), but I thought this library (based on other reports) only supported influxdb 1.x.

@msrd0
Copy link
Collaborator

msrd0 commented May 19, 2023

Hi, thanks for your bug report.

My research shows that the 'u' postfix for unsigned integers is only supported for influxdb 2.x (reference:influxdata/influxdb#17781)

That's interesting, the documentation for influxdb 1.8 seems to suggest the same: https://docs.influxdata.com/influxdb/v1.8/write_protocols/line_protocol_reference/#data-types. I wonder why this didn't cause any problems yet. @Empty2k12 has way more experience with influxdb, maybe he can comment.

but I thought this library (based on other reports) only supported influxdb 1.x

As far as I know, this library supports the backward-compatibility API of v2 since #118. I never actually used it though.

@eflukx
Copy link

eflukx commented Jun 21, 2023

Yep similar issue here. Reverting back to v0.5.2 (from v0.6.0) solved the issue

@msrd0
Copy link
Collaborator

msrd0 commented Jun 29, 2023

CC @mcronce

@Empty2k12
Copy link
Collaborator

Hey @brianmay @eflukx I have pushed #123 which makes the u suffix opt-in. It will be merged to main momentarily once @msrd0 is done reviewing. Could you test if this fixes the issue? Then we would be releasing the change

@brianmay
Copy link
Author

So far not getting any errors, so fingers crossed that means it is working.

Should now for sure tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants