Skip to content
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

Update the PHP transport classes section #1276

Closed

Conversation

RageZBla
Copy link
Contributor

This should be merged when version 2.3 of the PHP SDK.

Related to getsentry/sentry-php#855 and getsentry/sentry-php#787

@ste93cry
Copy link
Contributor

The section regarding the SpoolTransport needs an update too as it's still referring to the deprecated ClientBuilder::setTransport method 😉

@RageZBla
Copy link
Contributor Author

@ste93cry thanks for catching that, I have updated the merge request.

@dashed
Copy link
Member

dashed commented Nov 18, 2019

@RageZBla @ste93cry would you like this PR to be merged soon considering sentry-php v2.3 is now released?

@ste93cry
Copy link
Contributor

Version 2.3 is not released yet...

@dashed
Copy link
Member

dashed commented Nov 18, 2019

@ste93cry oof; you're right. I misread the version 😄

Copy link
Contributor

@ste93cry ste93cry left a comment

Choose a reason for hiding this comment

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

Now that we released 2.3 this PR can be merged once reviewed. I've left a few comments, but overall it looks good

$transport = new NullTransport();
$builder = ClientBuilder::create(['dsn' => '___PUBLIC_DSN___']);
$builder->setTransport($transport);
$options = ['dsn' => '___PUBLIC_DSN___'];
Copy link
Contributor

Choose a reason for hiding this comment

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

I would just inline this variable since we won't reuse it besides in the ClientBuilder::create method

use Sentry\Transport\HttpTransport;
use Sentry\State\Hub;
use Sentry\Transport\TransportFactoryInterface;

$options = ['dsn' => '___PUBLIC_DSN___'];
Copy link
Contributor

Choose a reason for hiding this comment

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

I would just inline this variable since we won't reuse it besides in the ClientBuilder::create method

'2.3'
);

$transportFactory = new class($httpClientFactory) implements TransportFactoryInterface {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of creating a custom factory, the DefaultTransportFactory can be used too in this case as the logic is basically the same. Of course if there was custom logic involved creating your own transport factory is still needed

$transportFactory = new class implements TransportFactoryInterface {
public function create(\Sentry\Options $options): \Sentry\Transport\TransportInterface
{
$spool = new MemorySpool();
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the spool is the class that users should interact with to flush the events, it should be instantiated outside of the factory

@HazAT
Copy link
Member

HazAT commented Jan 23, 2020

@RageZBla Would you be so kind and do the last changes so we can merge this?

@B-Galati
Copy link

Could you also update the interface where the deprecation comes from please? At the moment it is not possible to know what to do instead of calling \Sentry\ClientBuilderInterface::setHttpClient for example

@HazAT
Copy link
Member

HazAT commented Feb 6, 2020

Successor
#1489

@HazAT HazAT closed this Feb 6, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Dec 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants