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

Add alternative instrumentation abstraction

Open Nevay opened this issue 3 years ago • 3 comments

Adds global (context-scoped) tracer provider & co, intended to replace the current InstrumentationInterface.

$scope = InstrumentationConfigurator::create()
    ->withTracerProvider($tracerProvider)
    ->withPropagator($propagator)
    ->activate();

try {
    // ...
} finally {
    $scope->detach();
}
$instrumentation = new Instrumentation('io.opentelemetry.contrib.php');
// ...
$span = $instrumentation
    ->tracer() // returns a tracer for the currently active tracer provider
    ->spanBuilder('test')
    ->startSpan()

Nevay avatar Sep 10 '22 22:09 Nevay

Codecov Report

Merging #822 (d7c308d) into main (f73a835) will increase coverage by 0.22%. The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #822      +/-   ##
============================================
+ Coverage     81.52%   81.75%   +0.22%     
- Complexity     1925     1947      +22     
============================================
  Files           239      243       +4     
  Lines          5008     5069      +61     
============================================
+ Hits           4083     4144      +61     
  Misses          925      925              
Flag Coverage Δ
7.4 81.23% <90.16%> (+0.10%) :arrow_up:
8.0 81.75% <95.08%> (+0.16%) :arrow_up:
8.1 81.89% <95.08%> (+0.16%) :arrow_up:

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

Impacted Files Coverage Δ
...I/Common/Instrumentation/CachedInstrumentation.php 100.00% <100.00%> (ø)
src/API/Common/Instrumentation/Configurator.php 100.00% <100.00%> (ø)
src/API/Common/Instrumentation/ContextKeys.php 100.00% <100.00%> (ø)
src/API/Common/Instrumentation/Globals.php 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

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

codecov[bot] avatar Sep 10 '22 22:09 codecov[bot]

@Nevay happy for this to be merged?

brettmc avatar Oct 03 '22 06:10 brettmc

Should be ready after a rebase.

Nevay avatar Oct 09 '22 23:10 Nevay