Skip to content

Conversation

hendrikheil
Copy link
Contributor

I am by no means an expert in the OpenTelemetry spec, but I noticed that other auto instrumentations, like the ones available for python, record logs with the logger provider APIs.

Currently the Laravel auto instrumentation stores logs it encounters as events on the span. This PR changes this behavior to use the logger provider API instead.

@hendrikheil hendrikheil requested a review from a team August 7, 2024 08:48
Copy link

welcome bot commented Aug 7, 2024

Thanks for opening your first pull request! If you haven't yet signed our Contributor License Agreement (CLA), then please do so that we can accept your contribution. A link should appear shortly in this PR if you have not already signed one.

Copy link

linux-foundation-easycla bot commented Aug 7, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@bobstrecansky
Copy link
Contributor

cc:\ @ChrisLightfootWild

Copy link

codecov bot commented Aug 7, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 82.52%. Comparing base (c6c4b3c) to head (9c839a1).
Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...l/src/Hooks/Illuminate/Queue/AttributesBuilder.php 66.66% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #286      +/-   ##
============================================
+ Coverage     82.50%   82.52%   +0.02%     
  Complexity     1083     1083              
============================================
  Files           105      105              
  Lines          4578     4578              
============================================
+ Hits           3777     3778       +1     
+ Misses          801      800       -1     
Flag Coverage Δ
Aws 85.75% <ø> (ø)
Context/Swoole 0.00% <ø> (ø)
Instrumentation/CakePHP 87.75% <ø> (ø)
Instrumentation/CodeIgniter 73.94% <ø> (ø)
Instrumentation/ExtAmqp 89.58% <ø> (ø)
Instrumentation/ExtRdKafka 87.87% <ø> (ø)
Instrumentation/Guzzle 69.73% <ø> (ø)
Instrumentation/HttpAsyncClient 81.33% <ø> (ø)
Instrumentation/IO 70.90% <ø> (ø)
Instrumentation/Laravel 65.03% <91.66%> (+0.17%) ⬆️
Instrumentation/MongoDB 77.33% <ø> (ø)
Instrumentation/OpenAIPHP 86.82% <ø> (ø)
Instrumentation/PDO 89.56% <ø> (ø)
Instrumentation/Psr14 78.12% <ø> (ø)
Instrumentation/Psr15 93.50% <ø> (ø)
Instrumentation/Psr16 97.50% <ø> (ø)
Instrumentation/Psr18 82.08% <ø> (ø)
Instrumentation/Psr3 61.03% <ø> (ø)
Instrumentation/Psr6 97.61% <ø> (ø)
Instrumentation/Slim 86.95% <ø> (ø)
Instrumentation/Symfony 89.03% <ø> (ø)
Instrumentation/Yii 77.77% <ø> (ø)
Logs/Monolog 100.00% <ø> (ø)
Propagation/ServerTiming 100.00% <ø> (ø)
Propagation/TraceResponse 100.00% <ø> (ø)
ResourceDetectors/Azure 91.66% <ø> (ø)
ResourceDetectors/Container 93.02% <ø> (ø)
Shims/OpenTracing 92.99% <ø> (ø)
Symfony 88.20% <ø> (ø)

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

Files with missing lines Coverage Δ
...el/src/Hooks/Illuminate/Foundation/Application.php 100.00% <100.00%> (ø)
...nstrumentation/Laravel/src/Watchers/LogWatcher.php 100.00% <100.00%> (+7.69%) ⬆️
...l/src/Hooks/Illuminate/Queue/AttributesBuilder.php 85.71% <66.66%> (ø)

... and 1 file 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 c6c4b3c...9c839a1. Read the comment docs.

@brettmc
Copy link
Contributor

brettmc commented Aug 7, 2024

This has come up as an issue at least once before: https://cloud-native.slack.com/archives/C01NFPCV44V/p1715862811690339 so I think this change is probably the right way to go. Our Laravel maintainer is on leave currently, so a review might take a week or 2.

@hendrikheil
Copy link
Contributor Author

No rush, I'm glad the change is sensible in the first place 👍

@ChrisLightfootWild
Copy link
Contributor

@hendrikheil seems sensible to me to make this switch - can you please fix up the build failures around ordered imports? 👍

@ChrisLightfootWild
Copy link
Contributor

@hendrikheil thanks for sorting the import order; there's a few psalm errors thrown up now.

When you get time, would you be able to take a look please?


You can run the Laravel pipeline locally with:

make all PHP_VERSION=8.0 PROJECT=Instrumentation/Laravel

@hendrikheil
Copy link
Contributor Author

@ChrisLightfootWild Thanks for sharing that command, that definitely made tracking down all issues much easier!

I adjusted the failing tests for the new log data in the storage and resolved some deprecation warnings for PHP 8.4.

Let me know if you'd rather me send a dedicated PR for the deprecation warnings, then I'll undo those changes.

@brettmc
Copy link
Contributor

brettmc commented Aug 26, 2024

Let me know if you'd rather me send a dedicated PR for the deprecation warnings, then I'll undo those changes.

I fixed a bunch of those in the last few days, so rebasing off main might resolve them. If not, happy for them to be included in this PR.

@Maeldor
Copy link

Maeldor commented Aug 28, 2024

Thanks so much for doing this! OpenTelemetry noob here, and I wasted a week of debugging my configuration, dependencies, and endpoints wondering why I wasn't getting any logs 🤦🏻‍♂️

Looking forward to this getting merged!

Copy link
Contributor

@ChrisLightfootWild ChrisLightfootWild left a comment

Choose a reason for hiding this comment

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

I had a quick test of this and it looks to be emitting logs as expected.

image

Nice work!

@brettmc brettmc merged commit b10cb8d into open-telemetry:main Aug 29, 2024
117 checks passed
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.

5 participants