opentelemetry-php-contrib
                                
                                 opentelemetry-php-contrib copied to clipboard
                                
                                    opentelemetry-php-contrib copied to clipboard
                            
                            
                            
                        Exclude ApiPlatform test HttpClient from instrumentation
The client doesn't support the on_progress option and makes tests fail that use the ApiPlatform test client
Longer term we should probably maintain a blacklist or level up this instrumentation significantly so we know the allowed options
Codecov Report
Attention: Patch coverage is 41.66667% with 7 lines in your changes missing coverage. Please review.
Project coverage is 82.90%. Comparing base (
00bf8ba) to head (ae2de68).
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #235      +/-   ##
============================================
- Coverage     83.59%   82.90%   -0.69%     
+ Complexity     1057      980      -77     
============================================
  Files           104       96       -8     
  Lines          4389     3943     -446     
============================================
- Hits           3669     3269     -400     
+ Misses          720      674      -46     
Flags with carried forward coverage won't be shown. Click here to find out more.
| Files | Coverage Δ | |
|---|---|---|
| ...entation/Symfony/src/HttpClientInstrumentation.php | 87.65% <41.66%> (-8.06%) | :arrow_down: | 
... and 8 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 dataPowered by Codecov. Last update 00bf8ba...ae2de68. Read the comment docs.
If the pre hook doesn't start+activate a span, then the post hook could potentially deactivate some other scope, couldn't it? If so, might it be safer to create, activate and then end a span here so that the post hook works as expected? (I don't have access to a pc to actually test this, though)
@cedricziel - are you still planning on working on this PR?
We also just ran into this issue, but also ran into when using prophecy to mock the HttpClientInterface. In the case of prophecy, the issue is that because the instrumentation changes the client, it doesn't match the assertions.
$httpClient = $this->prophesize(HttpClientInterface::class);
$httpClient->request('GET', 'https://example.com')
            ->willReturn(new Response());
The problem is that Symfony will evaluate the $options array and will fail if the client doesn't support one of the provided options.
I'm adapting the instrumentation so that if will create a span, but need to close it manually in post hook as the callback method won't work.
I think the AMQP error is unrelated...
rebased. Unrelated style issues