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

Refactor value verification to manage bools. #5008

Merged
merged 3 commits into from
Nov 22, 2018

Conversation

ronnocol
Copy link
Contributor

@ronnocol ronnocol commented Nov 19, 2018

Strings are still dropped, bools are set to 1 for true and 0 for false
closes: #5006

Required for all PRs:

  • Signed CLA.
  • [n/a] Associated README.md updated.
  • Has appropriate unit tests.

Strings are still dropped, bools are set to 1 for true and 0 for false
Solves: influxdata#5006
case bool:
if field.Value == bool(true) {
// Store 1 for a "true" value
field.Value = 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you change this to copy to a local? I'm planning to change around FieldList() to prevent modification this way, it will give more predictable behavior during retries and harder to use the type incorrectly.

Might be easiest to rename verifyValue and have it return a value + bool so we don't have to switch twice:

func convertValue(v interface{}) (interface{}, bool)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

went back to having it called verifyValue() but I believe I implemented it in a fashion compatible with your request.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(I don't know what the protocol is for who should resolve the conversation)

@danielnelson danielnelson added this to the 1.10.0 milestone Nov 19, 2018
@danielnelson danielnelson added the fix pr to fix corresponding bug label Nov 19, 2018
Move value type verification and modification back to a function
store value modifications in a local.

Remove a bit of duplicate work.
@danielnelson danielnelson modified the milestones: 1.10.0, 1.9.1 Nov 19, 2018
@danielnelson danielnelson merged commit 85ee354 into influxdata:master Nov 22, 2018
danielnelson pushed a commit that referenced this pull request Nov 22, 2018
otherpirate pushed a commit to otherpirate/telegraf that referenced this pull request Mar 15, 2019
otherpirate pushed a commit to otherpirate/telegraf that referenced this pull request Mar 15, 2019
dupondje pushed a commit to dupondje/telegraf that referenced this pull request Apr 22, 2019
bitcharmer pushed a commit to bitcharmer/telegraf that referenced this pull request Oct 18, 2019
athoune pushed a commit to bearstech/telegraf that referenced this pull request Apr 17, 2020
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

splunkmetric serializer doesn't properly support bool values
3 participants