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

👷 Laravel instrumentation 1.1.x #269

Open
wants to merge 36 commits into
base: main
Choose a base branch
from

Conversation

ChrisLightfootWild
Copy link
Contributor

@ChrisLightfootWild ChrisLightfootWild commented Jun 10, 2024

WIP: current test approach needs tweaking.

Using new functionality provided via open-telemetry/opentelemetry-php#1304.

This should probably form the basis of a v1.1 package, so depends on a 1.0 release of the current Laravel instrumentation.


return $root
->canBeDisabled()
->addDefaultsIfNotSet()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd like to add a hooks array here with configuration of each hook, unless there's a better alternative?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you can do that, the laravel configuration schema can accept any shape you can define with symfony/config. For example, create an array for each component that is instrumented, which can individually be turned on/off, configure other values, ...

Copy link

codecov bot commented Jun 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.99%. Comparing base (0a41216) to head (504796e).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #269      +/-   ##
============================================
- Coverage     79.85%   77.99%   -1.86%     
+ Complexity      887      609     -278     
============================================
  Files            85       66      -19     
  Lines          3495     2577     -918     
============================================
- Hits           2791     2010     -781     
+ Misses          704      567     -137     
Flag Coverage Δ
Aws 85.55% <ø> (ø)
Instrumentation/CakePHP 20.00% <ø> (ø)
Instrumentation/CodeIgniter 73.77% <ø> (ø)
Instrumentation/ExtAmqp ?
Instrumentation/Guzzle 69.51% <ø> (ø)
Instrumentation/HttpAsyncClient 81.25% <ø> (ø)
Instrumentation/IO 70.68% <ø> (ø)
Instrumentation/MongoDB 76.31% <ø> (ø)
Instrumentation/OpenAIPHP 87.31% <ø> (?)
Instrumentation/PDO 89.95% <ø> (?)
Instrumentation/Psr14 77.14% <ø> (ø)
Instrumentation/Psr15 93.82% <ø> (ø)
Instrumentation/Psr16 97.56% <ø> (ø)
Instrumentation/Psr18 81.15% <ø> (ø)
Instrumentation/Psr3 ?
Instrumentation/Psr6 97.67% <ø> (ø)
Instrumentation/Slim 86.89% <ø> (ø)
Instrumentation/Symfony 88.70% <ø> (?)
Instrumentation/Yii 77.68% <ø> (ø)
Logs/Monolog ?
Propagation/ServerTiming 100.00% <ø> (ø)
Propagation/TraceResponse 100.00% <ø> (?)
ResourceDetectors/Container 93.02% <ø> (ø)
Sampler/RuleBased 33.51% <ø> (ø)
Shims/OpenTracing 92.45% <ø> (ø)
Symfony ?

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

see 37 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 0a41216...504796e. Read the comment docs.

Comment on lines 18 to 20
LoggerInterface $logger,
MeterInterface $meter,
TracerInterface $tracer,
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 I actually be passing the *ProviderInterfaces around?

My current understanding would be that I'd have to duplicate the instantiation or provide a Factory to give me back the implementations I want.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, I think you should. I also think you should just accept the InstrumentationContext here, and retrieve the providers you need for this particular hook (less rework if we add new providers in future). Also, I think the Tracer/Logger/etc for this hook should have a unique name that includes the component being instrumented, eg io.opentelemetry.contrib.php.laravel.kernel - the reason for this is that we can use scope configuration to turn off parts of auto-instrumentation based on that name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @brettmc, all of that sounds sensible. I will look to make the switch.

I will have to have a tinker with the scope configuration here and see how that goes!

@ChrisLightfootWild ChrisLightfootWild changed the title ⚠️ Experimental SPI with Laravel instrumentation 👷 👷 Laravel instrumentation 1.1.x Oct 30, 2024
"ext-json": "*",
"ext-opentelemetry": "*",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed based on similar issue raised for PDO instrumentation.

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.

2 participants