-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[confmap] Enable DecodeNil
option
#12996
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #12996 +/- ##
==========================================
+ Coverage 91.62% 91.64% +0.02%
==========================================
Files 504 504
Lines 27888 27886 -2
==========================================
+ Hits 25553 25557 +4
+ Misses 1844 1840 -4
+ Partials 491 489 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This comment was marked as resolved.
This comment was marked as resolved.
The So TLDR - OTEL hooks need to be modified to match |
@yurishkuro Okay, thanks. It still would make sense to me for mapstructure to give a more meaningful error rather than panic here, but I see what you mean. Can you review #13001 to move existing hooks into |
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description If we enable `DecodeNil` as true, we may have [untyped nils](https://go.dev/doc/faq#nil_error) being passed. Unfortunately, these are not valid values for `reflect`, which leads to surprising behavior such as golang/go/issues/51649. Unfortunately, the default hooks from mapstructure do not deal with this properly. To account for this, we: - Vendor and change the `ComposeDecodeHookFunc` function so that this case is accounted for the kinds of hooks that just won't work with untyped nils - Create a safe wrapper for the hooks that do work with untyped nils. This wrapper is used in all hooks, but in the interest of keeping as close to what I would imagine upstream will accept, I did not add this to the compose function. This should not have any end-user observable behavior. <!-- Issue number if applicable --> #### Link to tracking issue Attempt to work around #12996 (comment) --------- Co-authored-by: Evan Bradley <[email protected]>
@evan-bradley You can see on https://app.codecov.io/gh/open-telemetry/opentelemetry-collector/pull/12996/indirect-changes that this change leads to increased coverage on somes lines added over at #13001 Is there any other test you think we should add? I am honestly a bit scared every time I make changes on confmap, but in this case I am not even sure about what tests I would add here |
Great, thank you.
I can look through it more, some initial ideas:
Same here. I think if we merge this after today's release, that should hopefully give us two weeks to at least think it over or potentially catch any issues found by anyone using the latest from main. |
We discussed this offline and #12871 added tests that cover both of the situations I was asking about. At the moment I can't think of any other scenarios we need to test. |
Description
Enables
DecoderConfig.DecodeNil
Link to tracking issue
Taken from #10260
Updates #12981