sentry-php icon indicating copy to clipboard operation
sentry-php copied to clipboard

Add `use_local_relay` option

Open stayallive opened this issue 2 years ago • 3 comments

Relates to #1313.

This adds a use_local_relay option to the SDK option you can supply like:

Sentry\init([
    'dsn' => 'https://[email protected]/1234',
    'use_local_relay' => true,
]);

Internally this will result in the DSN used by the SDK to look like:

http://fa516ddb2fb44c44a2c4c9ce2638af99@localhost:3000/1234

(changing the scheme to http, the host to localhost and the port to 3000)

If relay is deployed elsewhere in the infrastructure the user can simply modify their own DSN to make the needed adjustments instead of us adding options for custom scheme, host and port when relay is used (hence the local in the option name). This is just a convenience option for when you deploy Relay next to your application.

This might need to be enhanced later to still supply the original scheme/domain/port to let Relay now where to relay to, but this is not supported by Relay yet so I've not added this here at this time.

stayallive avatar Jun 07 '22 11:06 stayallive

@Jean85 this is a draft PR meant as a discussion point and not gospel at this moment. Thanks for your feedback though!

There is nothing stopping the user from modifying their own DSN (see the PR text what to do in case it's not on localhost:3000) but this might not be the only change needed in the future so it might not be ideal now but might be less not-ideal in the future and a nice addition so I wanted to explore it.

Again this is a PR to aid in the discussions in #1313 and is still a work in progress / ongoing discussion 👍

(I'll update the label to hopefully reflect this better)

stayallive avatar Jun 08 '22 07:06 stayallive

I agree with @Jean85. Coding-wise, this PR looks perfect, but the usefulness of this change is a mistery for me. Why adding a new option, increasing the complexity of the software and the cognitive load for its users, when it would be enough to document how to get the DSN that points to Relay? As a user of Sentry, I know that everything I have to do to use it is more or less get the DSN, set it, and I should be ready to go. I don't care if the DSN is pointing to the server or to a proxy, it's the same for the end user.

ste93cry avatar Jun 10 '22 11:06 ste93cry

Please, let's curb the discussion for now until we are a little further in the process :)

I understand and appreciate the concerns you both are raising and I agree it does raise more questions at this point than answers, but some context is missing I'm not able to convey (very good) at this point in the process.

Again, I/we will never merge this before discussing this at length but it's not useful going into it at this moment this is just a placeholder hence the "In Progress" and "Discussion" labels and it being a draft PR!

Sorry for the noise and the unclearness at this point! It hopefully makes sense later 😉

stayallive avatar Jun 10 '22 11:06 stayallive