-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[exporterhelper] Use configoptional.Optional for exporterhelper QueueBatchConfig #14155
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
base: main
Are you sure you want to change the base?
[exporterhelper] Use configoptional.Optional for exporterhelper QueueBatchConfig #14155
Conversation
24c970f to
7efc984
Compare
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (84.61%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #14155 +/- ##
==========================================
- Coverage 92.25% 92.14% -0.12%
==========================================
Files 658 663 +5
Lines 41186 41384 +198
==========================================
+ Hits 37995 38132 +137
- Misses 2184 2214 +30
- Partials 1007 1038 +31 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Do you want to merge this PR first or fix contrib first? |
|
I'll prepare a contrib PR before merging this |
jmacd
left a comment
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.
This is great! The new configoptional is such an improvement.
I officially volunteer to help fix the contrib repo.
…al-for-exporterhelper-queuebatchconfig
|
Maintainers: https://cloud-native.slack.com/archives/C02JJK840SH/p1763412058572739 We've been discussing open-telemetry/opentelemetry-collector-contrib#44320, where I've proposed that a helper method like would help ergonomics and test readability. That doesn't entirely solve the problem, we're seeing tests that fail because of the |
.chloggen/mx-psi_configoptional-for-exporterhelper-queuebatchconfig.yaml
Outdated
Show resolved
Hide resolved
| return queuebatch.Config{ | ||
| Enabled: true, | ||
| func NewDefaultQueueConfig() configoptional.Optional[queuebatch.Config] { | ||
| return configoptional.Some(queuebatch.Config{ |
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.
Following up from an offline discussion, would it be a major inconvenience if we just returned the config directly here and required consumers to wrap it themselves? I feel like it would make tests easier and would make the function slightly less opinionated.
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.
I agree!
I still feel something's not perfect. We're recommending that users call configoptional.Default(...) or configoptional.Some(...) in order to disable or enable a feature by default. It sort of suggests adding a function named configoptional.Enabled(...) (for enabled with defaults) and configoptional.Disabled(...) (for disabled with defaults).
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.
I see your concern. I think this partially sources from the fact that we have the enabled field in configoptional now, as before it was just a way to think about the presence of a value at the time the function is called. The best I can think of off the top of my head is aliasing each function to EnabledByDefault and DisabledByDefault or similar, but I'd want to give it more thought before committing. If we go this route, would want the names to be very explicit since I think Enabled and Disabled are also a little ambiguous.
|
For QueueBatchConfig, there are many components that have the feature disabled by default. I'm worried that many users if they're just copying from another component, might find the use of But then, they're throwing away all the default settings, and users who want to enable this feature will have to supply all the fields with valid values, and new fields could break existing configs. I think we want this "disabled with defaults" case in every one of the places where I guess I'm asking if we can have a configoptional function called |
|
@jmacd I see your point. We could probably distill our
I may be missing a case or two here, but this seems viable at a glance. It would be unfortunate since we just declared this module v1, but I think we could easily declare each function deprecated with an easy replacement path. |
|
However, I think the behavior is somewhat complex since the functionality is somewhat complex, so we may just need to solve this with documentation either way. |
…onfig.yaml Co-authored-by: Evan Bradley <[email protected]>
Description
Uses
configoptional.Optionalforexporterhelper.QueueBatchConfig.Link to tracking issue
Updates #14021