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

auto-instrumentation registration

Open brettmc opened this issue 1 year ago • 2 comments

  • porting Nevay's PoC registering auto-instrumentation packages via SPI with file-based config.
  • extend to support auto-loading:
    • use the not-yet-released v0.3 of file-based configuration (which combines SDK and instrumentation config)
    • The existence of the OTEL_EXPERIMENTAL_CONFIG_FILE defines where the SDK config file resides (relative to CWD), and also acts as a trigger to autoload via SPI rather than our current env-based version
    • move single-use code (create hook manager + config parsing + actual registration) into classes
    • support general instrumentation config (which is described in the file-based config spec)
    • support map-based array-like config (which is used by instrumentation configuration)

todo:

  • [x] SDK autoloader should use noop hook manager if opentelemetry extension not available

brettmc avatar May 06 '24 11:05 brettmc

Codecov Report

Attention: Patch coverage is 52.78810% with 127 lines in your changes missing coverage. Please review.

Project coverage is 74.20%. Comparing base (17ad56a) to head (933dce7).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1304      +/-   ##
============================================
- Coverage     74.61%   74.20%   -0.41%     
- Complexity     2504     2562      +58     
============================================
  Files           355      372      +17     
  Lines          7180     7386     +206     
============================================
+ Hits           5357     5481     +124     
- Misses         1823     1905      +82     
Flag Coverage Δ
8.1 73.88% <52.78%> (-0.43%) :arrow_down:
8.2 74.13% <52.78%> (-0.38%) :arrow_down:
8.3 74.11% <52.78%> (-0.42%) :arrow_down:
8.4 74.05% <52.78%> (-0.45%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/API/Globals.php 100.00% <100.00%> (+5.88%) :arrow_up:
...tion/AutoInstrumentation/ConfigurationRegistry.php 100.00% <100.00%> (ø)
...PI/Instrumentation/AutoInstrumentation/Context.php 100.00% <100.00%> (ø)
...nstrumentation/AutoInstrumentation/HookManager.php 100.00% <100.00%> (ø)
src/API/Logs/LateBindingLogger.php 100.00% <100.00%> (ø)
src/API/Logs/LateBindingLoggerProvider.php 100.00% <100.00%> (ø)
src/API/Metrics/LateBindingMeterProvider.php 100.00% <100.00%> (ø)
src/API/Trace/LateBindingTracer.php 100.00% <100.00%> (ø)
src/API/Trace/LateBindingTracerProvider.php 100.00% <100.00%> (ø)
.../Config/SDK/Configuration/ConfigurationFactory.php 100.00% <100.00%> (+25.49%) :arrow_up:
... and 13 more

... and 9 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 17ad56a...933dce7. Read the comment docs.

codecov[bot] avatar May 06 '24 11:05 codecov[bot]

@open-telemetry/php-approvers @Nevay I think I'm happy with this and it's ready for review!

NB that we should not merge until a new version of opentelemetry-config is tagged, which should be v0.3

brettmc avatar Jun 25 '24 07:06 brettmc