Skip to content

New resource detector for DigitalOcean #382

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

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

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.

Copy link

codecov bot commented Jun 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.30%. Comparing base (39f190a) to head (97fc583).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #382      +/-   ##
============================================
+ Coverage     82.14%   82.30%   +0.16%     
- Complexity     1801     1817      +16     
============================================
  Files           137      138       +1     
  Lines          7594     7664      +70     
============================================
+ Hits           6238     6308      +70     
  Misses         1356     1356              
Flag Coverage Δ
Aws 92.59% <ø> (ø)
Context/Swoole 0.00% <ø> (ø)
Instrumentation/CakePHP 20.40% <ø> (ø)
Instrumentation/CodeIgniter 73.55% <ø> (ø)
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.28% <ø> (ø)
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 39f190a...97fc583. 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
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