-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Behaviour of ToStringMap
Not Matching Confmap Decoding Workflow
#11749
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
Comments
I would be okay changing this (I consider this an implementation detail). I believe this test was added by @songy23 because a change broke some tests on the Datadog Agent, but so long as it is clearly listed in the changelog and it does not break existing use cases (Datadog or otherwise) I am okay with it. |
I would prefer a dedicated PR for this :) |
@yurishkuro I am trying to do this again, this time hopefully without breaking anything. See #12872 |
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description <!-- Issue number if applicable --> A second attempt at #11882. Note that I added some tests in #12871 to prevent something like #12661 from happening again. #### Link to tracking issue Fixes #11749 <!--Describe what testing was performed and which tests were added.--> #### Testing <!--Describe the documentation added.--> See tests from #12871 as well as the new tests added here.
This question is related to #11734 which is working towards #10260 and #10266. The PR I have open enables the decoding of
nil
values inmapstructure
so that we can use an Optional type with a default value (see #10260 (comment) for more context). While enabling the decoding of nil values, I came across an issue where we were unable to differentiate between nil and empty slices. The reason for that is because we always initialize a nil slice and do not populate it if it is empty (see https://github.com/open-telemetry/opentelemetry-collector/blob/main/confmap/confmap.go#L135). In order to get around this, I added this patch in the PR above.This allows us to differentiate between a nil slice and an empty slice which we need in the
zeroSliceHookFunc
. However, that patch causes this unit test to fail because there's an expectation here that an empty slice gets rendered as nil when callingToStringMap
. I wanted to ask if it was valid to change this expectation so that it matches the decoding workflow we have in which an empty slice is preserved. cc @yurishkuroThe text was updated successfully, but these errors were encountered: