Skip to content

Conversation

@ChrisLightfootWild
Copy link
Contributor

@ChrisLightfootWild ChrisLightfootWild commented Mar 5, 2025

Proof of concept, to cover the use-case where multi-application installs operate on shared-infra and wish to provide their own configuration.

See #1436.


Any suggestions on the best way to approach adding tests for these optional dependencies?

EDIT: I added a test. It's not my proudest moment, but I can't think of another way to beat the way the SDK currently bootstraps and triggers Configuration setup so early on. We could modify the CompositeResolver to allow it's static instance to be reset - but that would be a change which was made purely to improve testability.

use OpenTelemetry\SDK\Common\Configuration\Resolver\ResolverInterface;
use function str_starts_with;

#[PackageDependency('vlucas/phpdotenv', '^5.0')]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @Nevay 👋

Speaking with @brettmc and he says you had some comments on .env processing n the past here. I did not recall this before throwing this together, apologies!

Do you have any concerns with delegating .env processing to the appropriately available packages via SPI?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, I was only concerned about implementing our own .env parsing.

@codecov
Copy link

codecov bot commented Mar 16, 2025

Codecov Report

❌ Patch coverage is 3.63636% with 53 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.28%. Comparing base (e54a43d) to head (40acb23).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...onfiguration/Resolver/SdkConfigurationResolver.php 0.00% 11 Missing ⚠️
src/Config/SDK/Configuration.php 0.00% 10 Missing ⚠️
src/Config/SDK/Instrumentation.php 0.00% 10 Missing ⚠️
...tion/Environment/Adapter/SymfonyDotenvProvider.php 0.00% 9 Missing ⚠️
...on/Environment/Adapter/VlucasPhpdotenvProvider.php 0.00% 7 Missing ⚠️
...ig/SDK/Configuration/Environment/LazyEnvSource.php 0.00% 6 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1523      +/-   ##
============================================
- Coverage     68.76%   68.28%   -0.48%     
- Complexity     2857     2868      +11     
============================================
  Files           425      429       +4     
  Lines          8704     8740      +36     
============================================
- Hits           5985     5968      -17     
- Misses         2719     2772      +53     
Flag Coverage Δ
8.1 ?
8.2 ?
8.3 ?
8.4 ?
8.5 68.28% <3.63%> (-0.28%) ⬇️

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

Files with missing lines Coverage Δ
...ommon/Configuration/Resolver/CompositeResolver.php 100.00% <100.00%> (ø)
...mon/Configuration/Resolver/EnvironmentResolver.php 100.00% <100.00%> (ø)
...K/Common/Configuration/Resolver/PhpIniResolver.php 100.00% <ø> (ø)
...ig/SDK/Configuration/Environment/LazyEnvSource.php 0.00% <0.00%> (ø)
...on/Environment/Adapter/VlucasPhpdotenvProvider.php 0.00% <0.00%> (ø)
...tion/Environment/Adapter/SymfonyDotenvProvider.php 0.00% <0.00%> (ø)
src/Config/SDK/Configuration.php 0.00% <0.00%> (ø)
src/Config/SDK/Instrumentation.php 0.00% <0.00%> (ø)
...onfiguration/Resolver/SdkConfigurationResolver.php 0.00% <0.00%> (ø)

... and 6 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 e54a43d...40acb23. Read the comment docs.

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

@ChrisLightfootWild ChrisLightfootWild marked this pull request as ready for review March 16, 2025 21:24
@ChrisLightfootWild ChrisLightfootWild requested a review from a team as a code owner March 16, 2025 21:24
@stale
Copy link

stale bot commented Apr 26, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale This issue didn't have recent activity label Apr 26, 2025
@brettmc brettmc added pinned Will not be removed by stalebot and removed stale This issue didn't have recent activity labels Apr 30, 2025
@ChrisLightfootWild ChrisLightfootWild marked this pull request as draft May 7, 2025 11:55
@Nevay Nevay mentioned this pull request Jun 28, 2025
@brettmc
Copy link
Contributor

brettmc commented Jun 29, 2025

This looks pretty solid now, would you like to rebase and we can get it merged @ChrisLightfootWild ?

@ChrisLightfootWild ChrisLightfootWild marked this pull request as ready for review July 12, 2025 21:39
@ChrisLightfootWild ChrisLightfootWild requested review from a team and brettmc July 12, 2025 21:42
@brettmc brettmc merged commit a54f48b into open-telemetry:main Aug 1, 2025
4 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pinned Will not be removed by stalebot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants