Skip to content
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 alternative instrumentation abstraction #822

Merged
merged 3 commits into from
Oct 16, 2022

Conversation

Nevay
Copy link
Contributor

@Nevay Nevay commented Sep 10, 2022

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()

@codecov
Copy link

codecov bot commented Sep 10, 2022

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%) ⬆️
8.0 81.75% <95.08%> (+0.16%) ⬆️
8.1 81.89% <95.08%> (+0.16%) ⬆️

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.

Copy link
Contributor Author

@Nevay Nevay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we merge this: SpanProcessors and MetricReaders should run exports with the Context they were created in.

deptrac.baseline.yaml Outdated Show resolved Hide resolved
use OpenTelemetry\Context\ScopeInterface;
use Psr\Log\LoggerInterface;

final class InstrumentationConfigurator
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this implement ImplicitContextKeyedInterface?

@Nevay Nevay marked this pull request as ready for review September 18, 2022 12:06
@Nevay Nevay requested a review from a team as a code owner September 18, 2022 12:06
@brettmc
Copy link
Collaborator

brettmc commented Oct 3, 2022

@Nevay happy for this to be merged?

@Nevay
Copy link
Contributor Author

Nevay commented Oct 9, 2022

Should be ready after a rebase.

@brettmc brettmc merged commit f6671dd into open-telemetry:main Oct 16, 2022
@Nevay Nevay deleted the feature/instrumentation branch April 19, 2023 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants