Wire the SDK client to the application's HTTP client - #47
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## fix/25-log-dropped-events #47 +/- ##
===============================================================
+ Coverage 76.70% 77.00% +0.30%
Complexity 139 139
===============================================================
Files 30 30
Lines 455 461 +6
===============================================================
+ Hits 349 355 +6
Misses 106 106 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
loevgaard
force-pushed
the
fix/25-log-dropped-events
branch
from
September 7, 2026 12:03
a0c147e to
324e9e7
Compare
loevgaard
force-pushed
the
fix/26-http-client-wiring
branch
from
September 7, 2026 12:03
155836b to
7d0d09e
Compare
loevgaard
force-pushed
the
fix/25-log-dropped-events
branch
from
September 7, 2026 12:18
324e9e7 to
1ed2b29
Compare
loevgaard
force-pushed
the
fix/26-http-client-wiring
branch
from
September 7, 2026 12:18
7d0d09e to
88c612e
Compare
loevgaard
force-pushed
the
fix/25-log-dropped-events
branch
from
September 7, 2026 12:46
1ed2b29 to
37e9af9
Compare
loevgaard
force-pushed
the
fix/26-http-client-wiring
branch
from
September 7, 2026 12:46
88c612e to
632c3c2
Compare
The client left the PSR-18 client and PSR-17 factories to runtime discovery, so requests to Meta never showed up in the profiler, ignored configured timeouts and could not be mocked in tests. Wire the application's services with on-invalid="ignore" so a missing service falls back to discovery, and add an http_client option for pointing Meta at a scoped client. Fixes #26
loevgaard
force-pushed
the
fix/25-log-dropped-events
branch
from
September 7, 2026 12:51
37e9af9 to
919b3dd
Compare
loevgaard
force-pushed
the
fix/26-http-client-wiring
branch
from
September 7, 2026 12:51
632c3c2 to
2a07fca
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #26
Problem
The SDK
Clientwas registered with only asetLogger()call, leaving the HTTP client, request factory and stream factory tophp-http/discoveryat runtime. That meant requests to Meta never appeared in the profiler's HttpClient panel, ignored any timeout, proxy, retry or scoped client configuration, could not be replaced by aMockHttpClientin tests, and depended on whichever PSR-18 implementation happened to be installed first.Change
The
Clientdefinition now callssetHttpClient(),setRequestFactory()andsetStreamFactory(), each withon-invalid="ignore". Symfony drops a method call whose argument cannot be resolved, so an application missing any of those services simply keeps the old discovery behaviour. Verified: in the test kernelpsr18.http_clientexists and the call survives, while the two PSR-17 factory services do not exist and those calls are removed.New
http_clientoption (defaultpsr18.http_client) points the bundle at a different PSR-18 service, which is how you give Meta its own timeout.README.mdshows the scoped client setup.The client also joins the
setono_meta_conversions_apiMonolog channel.Tests
psr18.http_clientwith aPsr18Clientwrapping aMockHttpClient, sends an event through the container'sClientInterface, and asserts the request wasPOST https://graph.facebook.com/v26.0/1234/events. That assertion only holds because the client is wired rather than discovered.http_clientat a service that does not exist and asserts the container still boots.RecordingHttpClientFactory) because a container definition cannot hold a live object.