opentelemetry-collector
opentelemetry-collector copied to clipboard
[otelcol] Allow passing confmap.Providers to otelcol.Collector
Description:
One way to work toward https://github.com/open-telemetry/opentelemetry-collector/issues/4759. This implements the second approach that I've outlined here: https://github.com/open-telemetry/opentelemetry-collector/issues/4759#issuecomment-1863082504.
I think the main advantage of this approach is that it cleans up the API for the package. otelcol.ConfigProvider is a fairly thin wrapper around confmap.Resolver, so I think we could ultimately remove the interface, and any custom functionality for config merging or unmarshaling could be exposed to users through settings rather through a custom implementation.
Link to tracking Issue:
Works toward https://github.com/open-telemetry/opentelemetry-collector/issues/4759
Testing:
Unit tests
Documentation:
Added Godoc comments.
Codecov Report
Attention: 1 lines in your changes are missing coverage. Please review.
Comparison is base (
f11c5bb) 90.70% compared to head (32ddd03) 90.74%.
| Files | Patch % | Lines |
|---|---|---|
| otelcol/collector.go | 92.85% | 0 Missing and 1 partial :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #9228 +/- ##
==========================================
+ Coverage 90.70% 90.74% +0.03%
==========================================
Files 347 347
Lines 18199 18212 +13
==========================================
+ Hits 16507 16526 +19
+ Misses 1369 1365 -4
+ Partials 323 321 -2
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This should be ready for review.
cc @mx-psi
@bogdandrutu Could you give this another look?
@bogdandrutu @mx-psi Any additional thoughts on this? I think this is good to go, and will pair well with https://github.com/open-telemetry/opentelemetry-collector/pull/9516.
@bogdandrutu will merge this tomorrow unless you raise any objections by then
@evan-bradley can you fix the conflict?
Thanks @mx-psi. Should be good now.
otelcol.ConfigProvider is a fairly thin wrapper around confmap.Resolver, so I think we could ultimately remove the interface, and any custom functionality for config merging or unmarshaling could be exposed to users through settings rather through a custom implementation.
Hey @evan-bradley, I just noticed this change today. We have a custom implementation of ConfigProvider mostly leveraging Watch() method to update our collector configurations dynamically. I don't see how the Watch method can be triggered with the new ResolverSettings?
@splunkericl can you file an issue for this?