-
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
[cmd/builder] Allow configuring confmap providers #9513
[cmd/builder] Allow configuring confmap providers #9513
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9513 +/- ##
==========================================
- Coverage 91.65% 91.63% -0.03%
==========================================
Files 360 360
Lines 16639 16676 +37
==========================================
+ Hits 15251 15281 +30
- Misses 1053 1058 +5
- Partials 335 337 +2 ☔ View full report in Codecov by Sentry. |
Providers *[]Module `mapstructure:"providers"` | ||
Converters *[]Module `mapstructure:"converters"` |
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.
Making these optional introduces a lot of code complexity, but is necessary unless we want to take one of two routes:
- Remove the ability for users to specify none of either and check whether the set of modules is empty. In my opinion, we should let users specify they want nothing included in their distribution in case they have unusual requirements.
- Remove the set of default converters/providers and require the user to always specify the modules they want included.
I don't necessarily mind option 2, but it would be a fairly significant breaking change and would need a long transition period. If we take option 2, we could move the defaults list to otelcol
and just always have the modules baked into every distro until we complete the transition.
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.
An alternative is to have a custom unmarshaling function that differentiates between unset and set but empty. I think this is cleaner and I agree that even if we go with 2 we would want to have a transition period
10c9316
to
0b7c8cb
Compare
0b7c8cb
to
1957bca
Compare
Both dependencies have been merged, is this ready for review? |
ad19f53
to
486d1cd
Compare
a30c06d
to
9b23b2a
Compare
@mx-psi I think this is ready to go, please take a look. |
9b23b2a
to
30de86e
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.
We don't have a clear policy regarding how big the difference in versions between the builder and the API used is, but given the precedent with #8692, I think we should strive to keep some compatibility with older versions of the API, at least for some amount of time. To that end we should guard uses of new modules or new API with a check of the otelcol_version
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
c95cbc6
to
c73195e
Compare
Will wait for #9516 before giving another pass to this one |
I've also been waiting for that, I will let you know once I update this PR to include those changes. |
…ings (#9516) **Description:** Follows #9443, relates to #9513. This builds on #9228 to demonstrate the concept. This shows one way of extending the otelcol APIs to allow passing converters and providers from the builder with the new settings structs for each type. I think this approach has a few advantages: 1. This follows our pattern of passing in "factory" functions instead of instances to the object that actually uses the instances. 2. Makes the API more declarative: the settings specify which modules to instantiate and which settings to instantiate them with, but don't require the caller to actually do this. 3. Compared to the current state, this allows us to update the config at different layers. A distribution's `main.go` file can specify the providers/converters it wants and leave the settings to be created by `otelcol.Collector`. The primary drawbacks I see here are: 1. This is a little more opinionated since you don't have access to the converter/provider instances or control how they are instantiated. I think this is acceptable and provides good encapsulation. 2. The scheme->provider map can now only be specified by the providers' schemes, which is how it is currently done by default. I would want to hear what use cases we see for more complex control here that necessitates using schemes not specified by the providers. cc @mx-psi --------- Co-authored-by: Evan Bradley <[email protected]>
adacf46
to
f2830f0
Compare
@mx-psi I've updated this to use confmap factories and to account for #9897. I've updated this to not use the new APIs if the builder is working with versions before v0.99.0. It looks like the new strict versioning functionality will force the builder and core API versions to be equal, according to this line. Should we expect that when the flag to skip strict versioning is removed we can also remove the v0.99.0 version check? |
@evan-bradley I did not intend for that change to go through just yet, and this is also not documented, so I filed #9999 to document it. We can handle this separately. IMO we should be a bit more lenient and allow for some version skew between the builder and the Collector being built (at least one minor version of difference should be fine based on our deprecation guidelines, and would be in line with the Kubernetes version skew policy) |
Thanks for the clarification. I agree we should probably allow some minor skew even if it's a bit inconvenient, it would feel pretty demanding to have to update the builder every single release. I think this PR should be unaffected by that change and should still be ready to go. |
Co-authored-by: Pablo Baeyens <[email protected]>
Co-authored-by: Pablo Baeyens <[email protected]>
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 merge on Monday morning
@MovieStoreGuy block before then if you still have any concerns
Co-authored-by: Pablo Baeyens <[email protected]>
Partially reverts #9897. This was not documented on the original PR and is IMO too strict. We likely want to allow for some skew between versions. Mentioned on #9513 (comment) --------- Co-authored-by: Alex Boten <[email protected]>
Description:
Allow configuring confmap providers in the builder's config. If the field isn't set, the default set of providers is used.
Link to tracking Issue:
Resolves #4759.
Testing:
Extended unit tests.
Documentation:
Updated the readme to include the new options in the example manifest file.
cc @mx-psi