You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #954, we discovered that booleans that default to true were being overridden when applying default values. When boolean values are processed by the defaults library, there is not way to distinguish between a false that was intentionally set and a zero boolean value. This results in the default boolean value being used (true in this case) making it not possible for a boolean that defaults to true to be set to false.
We fixed this by setting a pointer to a boolean value so that there are three possible states for a boolean: true, false and nil. If we send a nil boolean to the defaults library it is properly interpreted as unset and can be updated to false.
There is some technical debt leftover from this fix:
add a getter function for HoneycombLoggerConfig.SamplerEnabled
add a default-true type in order to avoid hardcoding true values in getter functions for related fields.
use something (reflect?) to do struct tag lookups to find default values in the getter functions instead of declaring defaults in multiple places
The text was updated successfully, but these errors were encountered:
@robbkidd Already added the GetSamplerEnabled getter function in #969. I suggested in that PR that perhaps getter functions for the other fields on HoneycombLoggerConfig should be added as well.
So, I did the work of trying to look up struct tags values using reflect in #996, but the consensus is that its wasteful to look up struct tags when we can instead put effort towards creating a defaultTrue type. I will try and work on adding that type.
## Which problem is this PR solving?
- Closes#970
## Short description of the changes
- adds a `DefaultTrue` type to use when specifying values with a default
of boolean `true` this improves some getter functions by abstracting
away the `*bool` behavior and allows boolean `true` be a true default
In #954, we discovered that booleans that default to true were being overridden when applying default values. When boolean values are processed by the defaults library, there is not way to distinguish between a
false
that was intentionally set and a zero boolean value. This results in the default boolean value being used (true
in this case) making it not possible for a boolean that defaults totrue
to be set tofalse
.We fixed this by setting a pointer to a boolean value so that there are three possible states for a boolean:
true
,false
andnil
. If we send anil
boolean to the defaults library it is properly interpreted as unset and can be updated tofalse
.There is some technical debt leftover from this fix:
HoneycombLoggerConfig.SamplerEnabled
default-true
type in order to avoid hardcoding true values in getter functions for related fields.The text was updated successfully, but these errors were encountered: