Skip to content
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

fix(inputs.upsd): always convert to float #12516

Merged
merged 8 commits into from
Jan 26, 2023
Merged

Conversation

powersj
Copy link
Contributor

@powersj powersj commented Jan 17, 2023

There are a number of values that can show up as a float or an int. This ensures the floats are always floats to avoid having some devices report as an int and others as a float and conflict in influxdb.

Additionally, if we fail to convert in either the float or string case, then skip trying to add the field.

fixes: #12501

There are a number of values that can show up as a float or an int. This
ensures the floats are always floats to avoid having some devices report
as an int and others as a float and conflict in influxdb.

Additionally, if we fail to convert in either the float or string case,
then skip trying to add the field.

fixes: influxdata#12501
@telegraf-tiger telegraf-tiger bot added fix pr to fix corresponding bug plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Jan 17, 2023
@powersj powersj added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Jan 17, 2023
Copy link
Contributor

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good code-wise, but shouldn't we add a flag to switch between previous behavior and the new one? We could name it native_values and discuss if the new or old behavior should be the default (I vote for the old one)...

@powersj
Copy link
Contributor Author

powersj commented Jan 18, 2023

shouldn't we add a flag to switch between previous behavior and the new one?

unfortunately, yes. I do not like the situation it puts new users in where we know they could start to run into issue and have to turn on an option to get consistent data and then go fix their database.

@srebhan
Copy link
Contributor

srebhan commented Jan 20, 2023

I'm not against setting the flag to a sensible default enabling the new behavior. We can still list this as a breaking change in the Changelog.

Copy link
Contributor

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. One cosmetic suggestion though...

plugins/inputs/upsd/upsd.go Outdated Show resolved Hide resolved
powersj and others added 2 commits January 25, 2023 07:40
Co-authored-by: Sven Rebhan <36194019+srebhan@users.noreply.github.com>
Copy link
Contributor

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @powersj!

@srebhan srebhan merged commit 4b445f6 into influxdata:master Jan 26, 2023
srebhan pushed a commit that referenced this pull request Jan 30, 2023
@sabey
Copy link

sabey commented Apr 5, 2024

this still persists in the latest release Telegraf 1.30.1 for nominal_battery_voltage

2024-04-05T10:15:26Z E! [outputs.influxdb] E! [outputs.influxdb] Failed to write metric (will be dropped: 400 Bad Request): partial write: field type conflict: input field "nominal_battery_voltage" on measurement "upsd" is type integer, already exists as type float dropped=1

@srebhan
Copy link
Contributor

srebhan commented Apr 10, 2024

@sabey please open a new issue instead of commenting on an old PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix pr to fix corresponding bug plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UPSD issue - load_percent presented as both int and float blocks writes from one group
3 participants