-
Notifications
You must be signed in to change notification settings - Fork 923
Add new convenience methods for converting DeclarativeConfigProperties to config model #7453
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 new convenience methods for converting DeclarativeConfigProperties to config model #7453
Conversation
…s to config model
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7453 +/- ##
============================================
+ Coverage 89.82% 89.90% +0.08%
- Complexity 6998 7028 +30
============================================
Files 798 799 +1
Lines 21199 21248 +49
Branches 2055 2060 +5
============================================
+ Hits 19041 19103 +62
+ Misses 1496 1488 -8
+ Partials 662 657 -5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Is this a way to treat declarative config like the old properties?
great idea!
I like that. |
No the map it spits out is an equivalent to the YAML node the |
...bator/src/main/java/io/opentelemetry/api/incubator/config/DeclarativeConfigPropertyUtil.java
Outdated
Show resolved
Hide resolved
|
Alright I've done a bit of reorganizing:
Updated the PR description to reflect these changes. |
...incubator/src/main/java/io/opentelemetry/api/incubator/config/InstrumentationConfigUtil.java
Outdated
Show resolved
Hide resolved
jkwatson
left a comment
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!
Add new methods:
Map<String, Object> DeclarativeConfigProperties#toMap(DeclarativeConfigProperties)convert any DeclarativeConfigProperties instance into a map representation using only the public API of the interfaceT InstrumentationConfigUtil#getInstrumentationConfigModel(ConfigModel, String instrumentationName, ObjectMapper, Class<T>)get the config for an instrumentation library and convert it to a model classTusing jackson'sObjectMapper.convertValueTogether, these help address open-telemetry/opentelemetry-java-instrumentation#14082
For example..
Assume an instrumentation library called is initialized with an instance of
ConfigProviderand has an internal configuration model class calledFooConfigModelrepresenting all of its configurable properties, it could initialize as follows:The
InstrumentationConfigUtil#getInstrumentationConfigModelhas a dependency on jackson, which users won't need / want. And so jackson is added as acompileOnlydependency. Users must add their own jackson dependency to use this convenience method.cc @zeitlinger, @jaydeluca