-
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
[configopaque] Mark as stable #9427
[configopaque] Mark as stable #9427
Conversation
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.
Feedback that I would like to make sure we address:
- Should we apply the same reasoning as @mx-psi did for
component.Type
and make this a struct that has a for example astring Raw()
to access the opaque string? - https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/configopaque/opaque_test.go uses yaml/v3 but we don't use that to unmarshal our configs. Should we actually test with
confmap
? - Not necessary impacting this, but would like all the implementation checks to be moved to tests (see https://github.com/open-telemetry/opentelemetry-collector/blob/main/config/configopaque/opaque.go#L17) so that the linker does unnecessary bring that dependency to non-test code if unnecessary. In this case is a system func so not that worry, but want to set a pattern.
Not all strings are valid |
Indeed, but I am worried about usability, I feel that explicitly have to call a func to get access to the underlying string clarifies the usage intent. This is not a blocker, but want to make sure we agree that is not an improvement and doesn't worth the effort. |
https://github.com/open-telemetry/opentelemetry-collector/pull/9430/files is open to follow up on this. |
I agree that something like s := configopaque.String("api-key")
r.Headers.Set("api-key", s.Raw()) is clearer than s := configopaque.String("api-key")
r.Headers.Set("api-key", string(s)) We could update the expectation to be:
A struct may also be more future proof way to ensure the underlying value isn't exposed like it used to be before we implemented But also, it be a big breaking change - at this point the use is quite widespread - the benefits may not outweigh the costs. |
Summary table of pros/cons (happy to edit and add more):
|
The way I see it we should test this on confmap:
|
@mx-psi then why do we test it with |
We can do it to not break contrib that bad:
Then change. |
Nothing special, just something that uses |
Looking at the pro/con table I'm not convinced that a change to a struct at this time is necessary. I think enough custom components outside Contrib are currently using this package that the breaking change would be significant. We've not received any user feedback that casting to a string is tricky and we've identified that expectation in the godoc. My opinion is that we move forward with the type as a string. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9427 +/- ##
==========================================
- Coverage 90.25% 90.24% -0.02%
==========================================
Files 344 344
Lines 17932 17932
==========================================
- Hits 16185 16182 -3
- Misses 1419 1421 +2
- Partials 328 329 +1 ☔ View full report in Codecov by Sentry. |
I filed:
|
My opinion is that the explicit syntax with a struct is easier to understand what's going on when you read the code, which is the majority of what we do. Fixing issues like this is what the unstable phase is for - iron out not only the mistakes, but also the rough edges that might make the code harder to read. I'm all for code readability and if this improves it (it does in my opinion), I believe it's worth doing. It's not the end of the world if we don't make this change of course 🙂 But I think the "product" will be better if we do. |
**Description:** - Remove yaml test from configopaque - Add test in confmap testing `configopaque` **Link to tracking Issue:** From discussion on #9427
@mx-psi should we add also an rc phase for this? |
@bogdandrutu On #8975 we decided not to do more release candidates, and instead be more time in beta. The criteria to be able to pass from beta to stable are the ones listed on #9167 (but of course ultimately we need approval from all maintainers :)). Is there anything specific that worries you about this package (additional to the things listed on #9427 (comment) )? |
@open-telemetry/collector-approvers as discussed offline, I believe we can merge this, 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.
🎉 🚀
Will wait until next Wednesday to merge this to get more feedback |
Description: Fixes #9167