opentelemetry-collector icon indicating copy to clipboard operation
opentelemetry-collector copied to clipboard

[otelcol] Allow passing confmap.Providers to otelcol.Collector

Open evan-bradley opened this issue 1 year ago • 5 comments
trafficstars

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.

evan-bradley avatar Jan 05 '24 15:01 evan-bradley

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.

codecov[bot] avatar Jan 05 '24 15:01 codecov[bot]

This should be ready for review.

cc @mx-psi

evan-bradley avatar Jan 23 '24 12:01 evan-bradley

@bogdandrutu Could you give this another look?

evan-bradley avatar Jan 31 '24 15:01 evan-bradley

@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.

evan-bradley avatar Feb 13 '24 12:02 evan-bradley

@bogdandrutu will merge this tomorrow unless you raise any objections by then

mx-psi avatar Feb 13 '24 13:02 mx-psi

@evan-bradley can you fix the conflict?

mx-psi avatar Feb 14 '24 09:02 mx-psi

Thanks @mx-psi. Should be good now.

evan-bradley avatar Feb 16 '24 00:02 evan-bradley

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 avatar Apr 18 '24 22:04 splunkericl

@splunkericl can you file an issue for this?

mx-psi avatar Apr 19 '24 10:04 mx-psi