feat: Add enabled resource providers configuration#4231
Conversation
Codecov Report
@@ Coverage Diff @@
## main #4231 +/- ##
============================================
+ Coverage 90.31% 90.33% +0.02%
+ Complexity 4749 4744 -5
============================================
Files 553 553
Lines 14600 14589 -11
Branches 1402 1404 +2
============================================
- Hits 13186 13179 -7
+ Misses 954 952 -2
+ Partials 460 458 -2
Continue to review full report at Codecov.
|
|
TBR |
| } | ||
|
|
||
| @Test | ||
| void onlyEnabledCustomResourceProvider() { |
There was a problem hiding this comment.
I think it would be good to have a unit test to verify the behavior when things are specified in both lists, especially when the same provider is in both lists.
There was a problem hiding this comment.
Sounds reasonable, I will add the missing unit tests.
| Resource result = Resource.getDefault(); | ||
|
|
||
| Set<String> enabledProviders = | ||
| new HashSet<>(config.getList("otel.java.enabled.resource.providers")); |
There was a problem hiding this comment.
Should we validate that only one of these is set as it would probably result in confusing behavior?
There was a problem hiding this comment.
I think the only missing case should be only setting the otel.java.enabled.resource.providers configuration. Only setting otel.java.disabled.resource.providers configuration is validated in other test case.
Add a new configuration:
otel.java.enabled.resource.providers.All resource providers will be enabled if this configuration key is not configured, otherwise only the specific resource providers will be enabled.
If a resource provider is configured in both
otel.java.enabled.resource.providersandotel.java.disabled.resource.providers, then it will be disabled.close #4220