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

add ComponentLoader to support more auto configuration scenarios

Open zeitlinger opened this issue 1 year ago • 1 comments

Part of https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/10409

Here's a PoC to show that the functionality actually works for spring boot: https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/10453

  • the new component loader: https://github.com/zeitlinger/opentelemetry-java/blob/1a6f0016521bfbdc7c7fc3900655efdd4df2fd16/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/ComponentLoader.java#L28-L42
  • this is the spring implementation of the component loader: https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/10453/files#diff-077c09a6a48b1e63a0d47867f73142466872586cf04fb2de15eb16c8da11d221R19-R72

Not sure what the API error means - it complains about an interface that was added:

image

zeitlinger avatar Feb 09 '24 14:02 zeitlinger

@jack-berg please take a look :smile:

zeitlinger avatar Feb 09 '24 14:02 zeitlinger

Codecov Report

Attention: Patch coverage is 88.23529% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 91.04%. Comparing base (1d4a2f4) to head (22996e0). Report is 2 commits behind head on main.

Files Patch % Lines
.../sdk/autoconfigure/internal/AutoConfigureUtil.java 71.42% 4 Missing :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6217      +/-   ##
============================================
- Coverage     91.06%   91.04%   -0.02%     
- Complexity     5695     5705      +10     
============================================
  Files           621      621              
  Lines         16667    16703      +36     
  Branches       1707     1709       +2     
============================================
+ Hits          15177    15208      +31     
- Misses          997     1002       +5     
  Partials        493      493              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Feb 19 '24 13:02 codecov[bot]

@jack-berg added all suggested changes - and even figured out how to appease jCmpApi (hopefully correctly).

zeitlinger avatar Feb 19 '24 16:02 zeitlinger

An additional SPI is needed for ConfigProperties - this is needed to create an adapter for spring properties: https://github.com/zeitlinger/opentelemetry-java/blob/c1534b5513b29c6ce6b8020bbf05a5bead68e5a2/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkBuilder.java#L571-L585

zeitlinger avatar Feb 19 '24 18:02 zeitlinger

An additional SPI is needed for ConfigProperties - this is needed to create an adapter for spring properties: https://github.com/zeitlinger/opentelemetry-java/blob/c1534b5513b29c6ce6b8020bbf05a5bead68e5a2/sdk-extensions/autoconfigure/src/main/java/io/opentelemetry/sdk/autoconfigure/AutoConfiguredOpenTelemetrySdkBuilder.java#L571-L585

sorry, just saw that there is already setConfig

zeitlinger avatar Feb 20 '24 09:02 zeitlinger

@jack-berg can you check again?

zeitlinger avatar Mar 05 '24 08:03 zeitlinger

Thanks @jack-berg for getting it into this release :tada:

zeitlinger avatar Mar 11 '24 13:03 zeitlinger