Skip to content

[http-client] No longer showing requests in the http_client profiler #49096

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

Closed
silverbackdan opened this issue Jan 24, 2023 · 12 comments
Closed

Comments

@silverbackdan
Copy link

Symfony version(s) affected

6.2.5

Description

In 6.2.2 I was getting trace information in the http_client profiler to run tests on so I could check some requests were made. In 6.2.5, the profiler no longer has this data.

How to reproduce

Using $collector = $this->getProfile()->getCollector('http_client') in my test, I loop through each client. The clients have an empty array in the trace property now.

Possible Solution

Investigating

Additional Context

No response

@silverbackdan
Copy link
Author

I can confirm that collectOnClient in HttpClientDataCollector is returning the traced requests.
This is an interesting one. The function collectOnClient seems to be called twice in my tests. The first time I can see the trace, and in the second the trace has gone.
I'm running Behat tests, I'm curious if perhaps the way in which I get the profiler data may need to be changed.

@silverbackdan
Copy link
Author

I can indeed see that for some reason, when I trace the calls to this function, it is being called from the behat test twice with the exact same stack trace. I assume that means in the most recent update, the trace is cleared once it has been read for the first time?

@silverbackdan
Copy link
Author

The Behat test appears to just call Symfony\Bundle\FrameworkBundle\KernelBrowser::request once from Behatch\HttpCall\Request\BrowserKit::send but I can see that the collectOnClient is being called twice. Any ideas much appreciated.

@nicolas-grekas
Copy link
Member

This was likely caused by #48898. /cc @pforesi is case you can have a look 🙏

@silverbackdan
Copy link
Author

Appreciated :)

@silverbackdan
Copy link
Author

silverbackdan commented Jan 24, 2023

This may only be a DELETE request issue. I don't think my GET request tests were failing.

To clarify, when I make a DELETE request to an endpoint, I am expecting an HTTP PURGE request to be made to a cache layer. When I create a PATCH request and expect that to result in a PURGE request to be sent to the cache layer, that test still works and I see the cache layer request in the http client traces.

But adding a conflict for the latest http client release does resolve the issue so that problem is somewhere in the http client component.

nicolas-grekas added a commit that referenced this issue Jan 25, 2023
… (nicolas-grekas)

This PR was merged into the 5.4 branch.

Discussion
----------

[HttpClient] Fix collecting data non-late for the profiler

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #49096
| License       | MIT
| Doc PR        | -

`@silverbackdan` `@pforesi` could you please confirm that this fixes both your use cases?

Commits
-------

3cb1d70 [HttpClient] Fix collecting data non-late for the profiler
@Laulibrius
Copy link
Contributor

Hi! I think this PR (#49104) broke something instead of fixing, since http_client requests was in profiler with v6.2.5 but not anymore with v6.2.6.
When i switch back http-client component to v6.2.5, it's working again.

@stof
Copy link
Member

stof commented Feb 1, 2023

If late data is missing when using the profile in WebTestCase, the right fix would be to make sure that lateCollect works in those cases, not to do hacks in various collectors IMO.

@fpaterno
Copy link

fpaterno commented Feb 2, 2023

Hi! I think this PR (#49104) broke something instead of fixing, since http_client requests was in profiler with v6.2.5 but not anymore with v6.2.6. When i switch back http-client component to v6.2.5, it's working again.

Same problem here with 5.4.20 version.

@jvengeon
Copy link

Same problem here in 6.2.6, Http Client tab is empty in profiler. When revert in 2.6.5, everything is ok. @nicolas-grekas an idea of the problem ?

@fancyweb
Copy link
Contributor

#49301 has been merged and fixed it.
Feel free to try the patch locally to confirm it works for you :-)

@jvengeon
Copy link

I tried the patch and it fixes the problem. Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants