-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[confmap] Add strict type validation under a feature gate #10400
Conversation
6781a9f
to
4cc21d9
Compare
4cc21d9
to
8c72aed
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10400 +/- ##
==========================================
- Coverage 92.40% 92.36% -0.04%
==========================================
Files 387 386 -1
Lines 18323 18353 +30
==========================================
+ Hits 16931 16952 +21
- Misses 1046 1050 +4
- Partials 346 351 +5 ☔ View full report in Codecov by Sentry. |
Instead of adding a new `WithStringRepresentation` public option, we make the `NewRetrievedFromYAML` method public. This makes it so that people can't add arbitrary string representations for their retrieved values, but instead only if the value is provided as YAML.
4e64b62
to
1ba8f79
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple question about tests, but otherwise the e2e tests are making me feel comfortable. the changed
logic in expand is confusing to me, I am going to see if I can make a quick PR to remove it.
Created #10403 to try and simplify some stuff before this PR |
Added a few more tests, @TylerHelmuth PTAL! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nits, LGTM overall
// This list must be kept in sync with checkRawConfType. | ||
input, err := ret.AsRaw() | ||
if err != nil { | ||
return "", err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this covered by e2e tests as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no way to hit this path today
opentelemetry-collector/confmap/provider.go
Line 152 in 48af1b8
return r.rawConf, nil |
|
||
const StrictlyTypedInputID = "confmap.strictlyTypedInput" | ||
|
||
var StrictlyTypedInputGate = featuregate.GlobalRegistry().MustRegister(StrictlyTypedInputID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: curious why this needs to be in internal? There may be contrib packages that want to test against this feature gate
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No strict need for this to be internal, but I would like to wait until someone asks for it to make it public
I am going to merge so this lands on the next release, we can discuss making it public once a component requests it |
Description
confmap.strictlyTypedInput
feature gate that introduces stricter type checks when resolving configurationconfmap.NewRetrievedFromYAML
function public so that external providers have consistent behavior when resolving YAMLconfmap.Retrieved.AsString
method to retrieve string representation for retrieved valuesLink to tracking issue
Relates to #9854, updates #8565, #9532