-
-
Notifications
You must be signed in to change notification settings - Fork 450
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
Sentry uses a lot of walltime #878
Comments
Also, IIRC with the current behavior, this wait is called in the shutdown function, so even after that your response has been rendered to the client. |
Hmm you could be right. Or did I miss something @nicolas-grekas? |
Thanks @nicolas-grekas for pointing that out. Closing since this seems to be a downstream issue with the Curl transport. As a workaround, you can switch out to any different transport supported by HTTPlug. |
I would recommend using the Symfony HttpClient by default. Version 4.4 will ship an |
I ended up doing this: class SentryHttpClient implements HttpAsyncClient
{
private $client;
public function __construct()
{
$factory = new Psr17Factory();
// DO NOT use the http client from Symfony or you could turn into an infinite loop depending on your monolog config and the if logging of HTTP request is enabled or not
$client = HttpClient::create(['timeout' => 2]);
$this->client = new Psr18Client($client, $factory, $factory);
}
/**
* {@inheritdoc}
*/
public function sendAsyncRequest(RequestInterface $request)
{
try {
$response = $this->client->sendRequest($request);
} catch (RequestExceptionInterface $e) {
return new HttpRejectedPromise(new RequestException($e->getMessage(), $request, $e));
} catch (NetworkExceptionInterface $e) {
return new HttpRejectedPromise(new NetworkException($e->getMessage(), $request, $e));
}
return new HttpFulfilledPromise($response);
}
} Works like a charm, thank you @nicolas-grekas! I'll update my symfony guide ASAP :-) |
Thank you @B-Galati, let me please know when its done 😃 |
@OskarStark Yes it's about to be merged in B-Galati/monolog-sentry-handler#8 Let me know for any feedback please :-) |
@B-Galati what about proposing your code to Httplug lib? |
@garak the proposed implementation is a dumb one that aims at solving a specific problem. I am not even sure it respects HttpPlug specs. In any case it is something that should be done in Symfony: see symfony/symfony#33710. |
Maybe this
wait()
can be fixed by using the new Symfony HttpClient?The text was updated successfully, but these errors were encountered: