Skip to content

Conversation

@smaddock
Copy link
Contributor

@smaddock smaddock commented Jun 4, 2025

There are only a couple existing contrib resource detectors, so I could be doing something wildly off here.

Current things I'm iffy on:

  • I've seen notes about abandoning Composer's file autoload and replacing with @Nevay's SPI loader, but I wasn't sure if that was possible to implement now.
  • I opened Deprecate Adapter\HttpDiscovery opentelemetry-php#1617; if that happens this class will need to be updated (not a big deal).
  • Similarly I used some odd methodology for the PHPUnit tests to get around dependencies on file_get_contents and error_log... I've seen a few SDK utility methods built around these, but the readfile was private so not reusable in the production code, and I was unsure how to best handle the SDK logging for PHPUnit.
  • I'm taking advantage of API credentials if they are provided, as DigitalOcean doesn't expose nearly as much "for free" as the larger cloud providers, but it's also not required... if it's not okay, though, I'll strip it out. I don't think I'll ever use it myself, just thought if it was available I'd make it work.
  • I'm sure there's more I'll remember later.

I'm marking this as draft until I get a chance to test it live.

@codecov
Copy link

codecov bot commented Jun 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.76%. Comparing base (138d1f1) to head (e585863).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #382      +/-   ##
============================================
+ Coverage     82.61%   82.76%   +0.14%     
- Complexity     1929     1945      +16     
============================================
  Files           141      142       +1     
  Lines          8063     8133      +70     
============================================
+ Hits           6661     6731      +70     
  Misses         1402     1402              
Flag Coverage Δ
Aws 92.59% <ø> (ø)
Context/Swoole 0.00% <ø> (ø)
Instrumentation/AwsSdk 81.13% <ø> (ø)
Instrumentation/CakePHP 20.40% <ø> (ø)
Instrumentation/CodeIgniter 73.55% <ø> (ø)
Instrumentation/Curl 90.42% <ø> (ø)
Instrumentation/Doctrine 92.72% <ø> (ø)
Instrumentation/ExtAmqp 88.48% <ø> (ø)
Instrumentation/ExtRdKafka 86.11% <ø> (ø)
Instrumentation/Guzzle 69.13% <ø> (ø)
Instrumentation/HttpAsyncClient 78.04% <ø> (ø)
Instrumentation/IO 70.68% <ø> (ø)
Instrumentation/Laravel 63.91% <ø> (ø)
Instrumentation/MongoDB 74.28% <ø> (ø)
Instrumentation/MySqli 95.81% <ø> (ø)
Instrumentation/OpenAIPHP 87.21% <ø> (ø)
Instrumentation/PDO 94.21% <ø> (ø)
Instrumentation/Psr14 76.47% <ø> (ø)
Instrumentation/Psr15 89.15% <ø> (ø)
Instrumentation/Psr16 97.50% <ø> (ø)
Instrumentation/Psr18 77.46% <ø> (ø)
Instrumentation/Psr3 67.01% <ø> (ø)
Instrumentation/Psr6 97.61% <ø> (ø)
Instrumentation/ReactPHP 99.44% <ø> (ø)
Instrumentation/Slim 86.11% <ø> (ø)
Instrumentation/Symfony 84.74% <ø> (ø)
Instrumentation/Yii 77.50% <ø> (ø)
Logs/Monolog 100.00% <ø> (ø)
Propagation/Instana 98.11% <ø> (ø)
Propagation/ServerTiming 100.00% <ø> (ø)
Propagation/TraceResponse 100.00% <ø> (ø)
ResourceDetectors/Azure 91.66% <ø> (ø)
ResourceDetectors/Container 93.02% <ø> (ø)
ResourceDetectors/DigitalOcean 100.00% <100.00%> (?)
Sampler/RuleBased 33.51% <ø> (ø)
Shims/OpenTracing 92.45% <ø> (ø)
Symfony 87.81% <ø> (ø)
Utils/Test 87.53% <ø> (ø)

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

Files with missing lines Coverage Δ
...etectors/DigitalOcean/src/DigitalOceanDetector.php 100.00% <100.00%> (ø)

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 138d1f1...e585863. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ChrisLightfootWild
Copy link
Contributor

ChrisLightfootWild commented Jun 4, 2025

I've seen notes about abandoning Composer's file autoload and replacing with @Nevay's SPI loader, but I wasn't sure if that was possible to implement now.

It looks like this is currently only possible in the 2.x branch. This might be a reason to nudge closer towards 2.x though 🤞

@ChrisLightfootWild
Copy link
Contributor

Similarly I used some odd methodology for the PHPUnit tests to get around dependencies on file_get_contents and error_log... I've seen a few SDK utility methods built around these, but the readfile was private so not reusable in the production code, and I was unsure how to best handle the SDK logging for PHPUnit.

Could the vfsstream wrappers work for you here? I guess you have probably seen them already, but see here for reference - just in case!

@smaddock
Copy link
Contributor Author

smaddock commented Jun 4, 2025

Could the vfsstream wrappers work for you here? I guess you have probably seen them already, but see here for reference - just in case!

Interesting! I saw they existed but didn't look into them. Yeah I can use them... it feels "hacky" to have the $dir = '/' parameter in the Host constructor just to make it testable? I couldn't figure out why that was there yesterday and now I'm thinking it's solely for the test. Which feels like a "code smell" to me, but admittedly the way I'm doing it is also "hacky", so if passing a root path is more standard practice I'm happy to switch.

@smaddock smaddock marked this pull request as ready for review June 4, 2025 17:04
@smaddock smaddock requested a review from a team as a code owner June 4, 2025 17:04
@brettmc
Copy link
Contributor

brettmc commented Jun 10, 2025

I've seen notes about abandoning Composer's file autoload and replacing with @Nevay's SPI loader, but I wasn't sure if that was possible to implement now.

For now, stick with autoload->files mechanism. It's pretty trivial to switch when we get to that part (and autoload->files can be backwards-compatible to SDK 1.x)

@smaddock
Copy link
Contributor Author

This should be good to merge now.

@ChrisLightfootWild ChrisLightfootWild requested a review from a team June 11, 2025 12:48
@brettmc brettmc merged commit 30fb8ff into open-telemetry:main Jun 11, 2025
148 checks passed
@smaddock smaddock deleted the digitalocean branch June 11, 2025 18:29
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.

3 participants