-
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
Add a NewConfigProvider that uses options for settings, and does input validation #4936
Conversation
f983845
to
e1fca07
Compare
Codecov Report
@@ Coverage Diff @@
## main #4936 +/- ##
==========================================
- Coverage 90.33% 90.29% -0.05%
==========================================
Files 185 185
Lines 11000 11041 +41
==========================================
+ Hits 9937 9969 +32
- Misses 837 844 +7
- Partials 226 228 +2
Continue to review full report at Codecov.
|
e1fca07
to
bda2750
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.
I like this NewConfigProvider
more than the current one. I left some comments
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
d5ff8df
to
9761e5a
Compare
9761e5a
to
9d89a66
Compare
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
Folllowup: * When the deprecated funcs/types are removed the internal package can be moved to service/internal. * Part of open-telemetry#4936 do not offer ability to configure ConfigUnmarshaler. Motivation: This package is removed because with the latest addition of the `service.ConfigProvider` the usecase to change the unmarshaled config.Config can be achieved by wrapping/implementing that interface, so no clear use-case for this. In the future we can expose it again if we have good reasons. Updates open-telemetry#4605 Signed-off-by: Bogdan Drutu <[email protected]>
Folllowup: * When the deprecated funcs/types are removed the internal package can be moved to service/internal. * Part of open-telemetry#4936 do not offer ability to configure ConfigUnmarshaler. Motivation: This package is removed because with the latest addition of the `service.ConfigProvider` the usecase to change the unmarshaled config.Config can be achieved by wrapping/implementing that interface, so no clear use-case for this. In the future we can expose it again if we have good reasons. Updates open-telemetry#4605 Signed-off-by: Bogdan Drutu <[email protected]>
Folllowup: * When the deprecated funcs/types are removed the internal package can be moved to service/internal. * Part of open-telemetry#4936 do not offer ability to configure ConfigUnmarshaler. Motivation: This package is removed because with the latest addition of the `service.ConfigProvider` the usecase to change the unmarshaled config.Config can be achieved by wrapping/implementing that interface, so no clear use-case for this. In the future we can expose it again if we have good reasons. Updates open-telemetry#4605 Signed-off-by: Bogdan Drutu <[email protected]>
Folllowup: * When the deprecated funcs/types are removed the internal package can be moved to service/internal. * Part of open-telemetry#4936 do not offer ability to configure ConfigUnmarshaler. Motivation: This package is removed because with the latest addition of the `service.ConfigProvider` the usecase to change the unmarshaled config.Config can be achieved by wrapping/implementing that interface, so no clear use-case for this. In the future we can expose it again if we have good reasons. Updates open-telemetry#4605 Signed-off-by: Bogdan Drutu <[email protected]>
9d89a66
to
e79931b
Compare
Folllowup: * When the deprecated funcs/types are removed the internal package can be moved to service/internal. * Part of open-telemetry#4936 do not offer ability to configure ConfigUnmarshaler. Motivation: This package is removed because with the latest addition of the `service.ConfigProvider` the usecase to change the unmarshaled config.Config can be achieved by wrapping/implementing that interface, so no clear use-case for this. In the future we can expose it again if we have good reasons. Updates open-telemetry#4605 Signed-off-by: Bogdan Drutu <[email protected]>
Folllowup: * When the deprecated funcs/types are removed the internal package can be moved to service/internal. * Part of open-telemetry#4936 do not offer ability to configure ConfigUnmarshaler. Motivation: * This package is removed because with the latest addition of the `service.ConfigProvider` the usecase to change the unmarshaled config.Config can be achieved by wrapping/implementing that interface, so no clear use-case for this. In the future we can expose it again if we have good reasons. * During the review of another PR, this was mentioned as something some approvers/maintainers were concerned about what to do with this package. See open-telemetry#4608 (review) Updates open-telemetry#4605 Signed-off-by: Bogdan Drutu <[email protected]>
Folllowup: * When the deprecated funcs/types are removed the internal package can be moved to service/internal. * Part of open-telemetry#4936 do not offer ability to configure ConfigUnmarshaler. Motivation: * This package is removed because with the latest addition of the `service.ConfigProvider` the usecase to change the unmarshaled config.Config can be achieved by wrapping/implementing that interface, so no clear use-case for this. In the future we can expose it again if we have good reasons. * During the review of another PR, this was mentioned as something some approvers/maintainers were concerned about what to do with this package. See open-telemetry#4608 (review) Updates open-telemetry#4605 Signed-off-by: Bogdan Drutu <[email protected]>
e79931b
to
1d88e19
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.
Thanks for addressing my suggestions. Just one comment in the discussion w/ @Aneurysm9 & @mx-psi. It would be good to agree on the way to move forward.
a3c5d6b
to
c177990
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.
LGTM, the only contention point seems to be about calling WithConfigMapConverters multiple times. Once that is sorted out, either by returning an error on the second call or by using a settings object instead of options, this would be ready to be merged.
6b71755
to
ea7c2b4
Compare
), | ||
})) | ||
cfgSet := NewDefaultConfigProviderSettings() | ||
cfgSet.Locations = []string{ |
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 didn't know this before, but I prefer this so much more than the previous iteration.
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.
Overall I like this a lot. Just a question and a couple of nits
Unmarshaler configunmarshaler.ConfigUnmarshaler | ||
} | ||
|
||
func newDefaultConfigProviderSettings() ConfigProviderSettings { |
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'm probably missing this somewhere, but as a user is there a way for me to obtain the defaults from outside this package? I'm thinking of the case where someone may only want to override the locations but not the default providers/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.
I think, if we go with the same model as the Factories for components, we should not have any "defaults" every distribution will pick their "defaults" that they commit to support. All the components that we use in the "default" config are also public, so a distro can emulate the same if this is what they want.
…ation Signed-off-by: Bogdan Drutu <[email protected]>
Signed-off-by: Bogdan Drutu <[email protected]>
422a3d2
to
46ce4bf
Compare
Signed-off-by: Bogdan Drutu <[email protected]>
46ce4bf
to
a08acfa
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.
Using a struct resolves the ambiguity of repeating an option, I only have two nits but otherwise LGTM
var err error | ||
cfgSet := newDefaultConfigProviderSettings() | ||
cfgSet.Locations = getConfigFlag() | ||
// Append the "overwrite properties converter" as the first converter. | ||
cfgSet.MapConverters = append( | ||
[]config.MapConverterFunc{overwritepropertiesmapconverter.New(getSetFlag())}, | ||
cfgSet.MapConverters...) | ||
set.ConfigProvider, err = NewConfigProvider(cfgSet) | ||
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.
This and the collector_windows
code are the same, should we extract it to a function?
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 do in a separate PR.
Signed-off-by: Bogdan Drutu <[email protected]>
Folllowup: * When the deprecated funcs/types are removed the internal package can be moved to service/internal. * Part of open-telemetry#4936 do not offer ability to configure ConfigUnmarshaler. Motivation: * This package is removed because with the latest addition of the `service.ConfigProvider` the usecase to change the unmarshaled config.Config can be achieved by wrapping/implementing that interface, so no clear use-case for this. In the future we can expose it again if we have good reasons. * During the review of another PR, this was mentioned as something some approvers/maintainers were concerned about what to do with this package. See open-telemetry#4608 (review) Updates open-telemetry#4605 Signed-off-by: Bogdan Drutu <[email protected]>
Signed-off-by: Bogdan Drutu <[email protected]>
Folllowup: * When the deprecated funcs/types are removed the internal package can be moved to service/internal. * Part of open-telemetry#4936 do not offer ability to configure ConfigUnmarshaler. Motivation: * This package is removed because with the latest addition of the `service.ConfigProvider` the usecase to change the unmarshaled config.Config can be achieved by wrapping/implementing that interface, so no clear use-case for this. In the future we can expose it again if we have good reasons. * During the review of another PR, this was mentioned as something some approvers/maintainers were concerned about what to do with this package. See open-telemetry#4608 (review) Updates open-telemetry#4605 Signed-off-by: Bogdan Drutu <[email protected]>
Folllowup: * When the deprecated funcs/types are removed the internal package can be moved to service/internal. * Part of open-telemetry#4936 do not offer ability to configure ConfigUnmarshaler. Motivation: * This package is removed because with the latest addition of the `service.ConfigProvider` the usecase to change the unmarshaled config.Config can be achieved by wrapping/implementing that interface, so no clear use-case for this. In the future we can expose it again if we have good reasons. * During the review of another PR, this was mentioned as something some approvers/maintainers were concerned about what to do with this package. See open-telemetry#4608 (review) Updates open-telemetry#4605 Signed-off-by: Bogdan Drutu <[email protected]>
Folllowup: * When the deprecated funcs/types are removed the internal package can be moved to service/internal. * Part of #4936 do not offer ability to configure ConfigUnmarshaler. Motivation: * This package is removed because with the latest addition of the `service.ConfigProvider` the usecase to change the unmarshaled config.Config can be achieved by wrapping/implementing that interface, so no clear use-case for this. In the future we can expose it again if we have good reasons. * During the review of another PR, this was mentioned as something some approvers/maintainers were concerned about what to do with this package. See #4608 (review) Updates #4605 Signed-off-by: Bogdan Drutu <[email protected]>
…t validation (open-telemetry#4936) * Change deprecated NewConfigProvider to use options and do input validation Signed-off-by: Bogdan Drutu <[email protected]> * Revert deprecation of WithConfigUnmarshaler Signed-off-by: Bogdan Drutu <[email protected]> * Change to use settings for the ConfigProvider Signed-off-by: Bogdan Drutu <[email protected]> * Update service/config_provider.go Co-authored-by: Alex Boten <[email protected]>
…telemetry#5185) Signed-off-by: Bogdan Drutu <[email protected]>
…try#5151) Folllowup: * When the deprecated funcs/types are removed the internal package can be moved to service/internal. * Part of open-telemetry#4936 do not offer ability to configure ConfigUnmarshaler. Motivation: * This package is removed because with the latest addition of the `service.ConfigProvider` the usecase to change the unmarshaled config.Config can be achieved by wrapping/implementing that interface, so no clear use-case for this. In the future we can expose it again if we have good reasons. * During the review of another PR, this was mentioned as something some approvers/maintainers were concerned about what to do with this package. See open-telemetry#4608 (review) Updates open-telemetry#4605 Signed-off-by: Bogdan Drutu <[email protected]>
This is a fork of #4762
Also, deprecates
service.MustNewConfigProvider
andservice.MustNewDefaultConfigProvider
in favor ofservice.NewConfigProvider
.Signed-off-by: Bogdan Drutu [email protected]