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

Use SENTRY_SPOTLIGHT as default value for Spotlight options #1789

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stayallive
Copy link
Collaborator

@stayallive stayallive commented Nov 14, 2024

This reads SENTRY_SPOTLIGHT environment variable as source of truth and also allows passing the URL directly to the spotlight option.

Related getsentry/spotlight#545 and getsentry/spotlight#482

@stayallive stayallive marked this pull request as ready for review November 14, 2024 11:51
Copy link
Member

@BYK BYK left a comment

Choose a reason for hiding this comment

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

LGTM but won't approve until someone from the PHP SDK team takes a look at this.

@@ -1187,7 +1191,7 @@ private function configureOptions(OptionsResolver $resolver): void
$resolver->setAllowedTypes('in_app_exclude', 'string[]');
$resolver->setAllowedTypes('in_app_include', 'string[]');
$resolver->setAllowedTypes('logger', ['null', LoggerInterface::class]);
$resolver->setAllowedTypes('spotlight', 'bool');
$resolver->setAllowedTypes('spotlight', ['bool', 'string', 'null']);
$resolver->setAllowedTypes('spotlight_url', 'string');
Copy link
Member

@BYK BYK Nov 14, 2024

Choose a reason for hiding this comment

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

This is probably obsolete now. (this referring to spotlight_url)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, this should be marked as deprecated, can't remove it yet but will be slated to be removed in 5.x will update the code to mark it as such!

Comment on lines +675 to +683
return [
['', false, $defaultSpotlightUrl],
['true', true, $defaultSpotlightUrl],
['1', true, $defaultSpotlightUrl],
['false', false, $defaultSpotlightUrl],
['0', false, $defaultSpotlightUrl],
['null', false, $defaultSpotlightUrl],
['http://localhost:1234', true, 'http://localhost:1234'],
['some invalid looking value', false, $defaultSpotlightUrl],
Copy link
Member

Choose a reason for hiding this comment

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

@BYK
Copy link
Member

BYK commented Nov 19, 2024

@cleptric ?

@cleptric
Copy link
Member

@BYK ?

@BYK
Copy link
Member

BYK commented Nov 19, 2024

Lol -- @cleptric was wondering if you have any objections as last time we talked about this you seemed on the fence for making $SENTRY_SPOTLIGHT being both boolean and a string. I can approve and get this merged but wanted to get your blessing first.

@cleptric
Copy link
Member

My opinion on this didn't change, but I won't object these changes.
Once @stayallive added the deprecation annotations, we can get this merged.

Copy link
Member

@BYK BYK left a comment

Choose a reason for hiding this comment

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

Sending back for deprecation changes.

return false;
}

if (str_starts_with($booleanOrUrl, 'http')) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious why CI does not fail here, as str_starts_with is only available since PHP 8.0. We removed all polyfills, so maybe our CI setup adds some intransparent extensions?

I would prefer we use FILTER_VALIDATE_URL here.

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

Successfully merging this pull request may close these issues.

3 participants