Closed Evesy closed 7 years ago
@Evesy it looks good, can you add a test please?
@Evesy thanks for adding those tests which look good to me.
@cwjohnston his looks good to me, do you have any issues with pushing this logic here? I think it could be helpful to solve the same issue across multiple plugins.
Seems reasonable and tests look good. Thanks!
cool, I will cut a release shortly then.
Apparently the build process is different for this plugin I have opened #175 as I do not see why the process should be different even if the access is. We should figure this out before accepting any more changes.
Additional helper method
cast_bool_values_int
to convert a provided boolean string to respective integer value.Description
This method accepts a single value, converting a true or false string to 1 or 0 respectively. Any other values will just be returned.
Motivation and Context
In certain metric collection plugins, metrics are occasionally generated with true/false values rather than integers. Certain TSDB's will not accept boolean values and instead expect integer equivalents (i.e. Graphite, true = 1, false = 0). See https://github.com/sensu-plugins/sensu-plugins-elasticsearch/issues/49 for reference
This helper method allows, where applicable, these values to be converted into integers so they can be successfully ingested by those TSDB's.
How Has This Been Tested?
Tested new method in local environment
Types of changes
Checklist:
Known Caveats