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 elasticsearch sending booleans to opentsdb #429

Merged
merged 1 commit into from
Sep 17, 2020

Conversation

bjozet
Copy link
Contributor

@bjozet bjozet commented Aug 27, 2019

Added a generic bool-to-int convert in printmetric-function, so that any
booleans sent for printing will be converted to an integer.
Fixes an an issue where the metric is_master tried to send boolean
values, causing opentsdb to log java.lang.NumberFormatException: For input string: "False"

If this is too generic, one could fix the specific is_master value in
_collect_server-function, line 185 or 187 by explicitly changing only
that to int(), but figured the generic approach is future-proof for any
other metrics that might slip through as booleans.

Added a generic bool-to-int convert in printmetric-function, so that any
booleans sent for printing will be converted to an integer.
Fixes an an issue where the metric `is_master` tried to send boolean
values.

If this is too generic, one could fix the specific `is_master` value in
`_collect_server`-function, line
[185](https://github.com/OpenTSDB/tcollector/blob/master/collectors/0/elasticsearch.py#L185)
or
[187](https://github.com/OpenTSDB/tcollector/blob/master/collectors/0/elasticsearch.py#L187)
by explicitly changing only that to `int()`, but figured the generic
approach is future-proof for any other metrics that might slip through
as booleans.
@johann8384 johann8384 merged commit 861608e into OpenTSDB:master Sep 17, 2020
@johann8384 johann8384 added this to the 1.3.3 milestone Sep 17, 2020
@bjozet
Copy link
Contributor Author

bjozet commented Sep 17, 2020

@johann8384, you're on fire! Awesome work, thank you for your efforts!

@johann8384
Copy link
Member

johann8384 commented Sep 17, 2020 via email

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 this pull request may close these issues.

2 participants