Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Sentry/Client.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ has scope => sub { Sentry::Hub::Scope->new };
has integrations => sub ($self) { $self->_options->{integrations} // [] };

sub setup_integrations ($self) {
Sentry::Integration->setup($self->integrations);
Sentry::Integration->setup($self->integrations, $self->_options->{default_integrations} // 1)
}

# (alternatively normal constructor) This takes typically an object with options + dsn.
Expand Down
20 changes: 11 additions & 9 deletions lib/Sentry/Integration.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ use Sentry::Integration::MojoUserAgent;
use Sentry::Integration::MojoTemplate;
use Sentry::Integration::LwpUserAgent;

my @Global_integrations = (
Sentry::Integration::DieHandler->new,
Sentry::Integration::DBI->new,
Sentry::Integration::MojoUserAgent->new,
Sentry::Integration::MojoTemplate->new,
Sentry::Integration::LwpUserAgent->new,
);
sub default_integrations {
return (
Sentry::Integration::DieHandler->new,
Sentry::Integration::DBI->new,
Sentry::Integration::MojoUserAgent->new,
Sentry::Integration::MojoTemplate->new,
Sentry::Integration::LwpUserAgent->new,
);
}

sub setup ($package, $custom_integrations = []) {
my @all_integrations = (@Global_integrations, $custom_integrations->@*);
sub setup ($package, $custom_integrations = [], $use_defaults = 1) {
my @all_integrations = ($use_defaults ? default_integrations() : (), $custom_integrations->@*);
foreach my $integration (grep { !$_->initialized } @all_integrations) {
$integration->setup_once(
Sentry::Hub::Scope->can('add_global_event_processor'),
Expand Down
2 changes: 1 addition & 1 deletion lib/Sentry/SDK.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ sub _init_and_bind ($options) {
}

sub init ($package, $options = {}) {
$options->{default_integrations} //= [];
$options->{default_integrations} //= 1;
$options->{dsn} //= $ENV{SENTRY_DSN};
$options->{traces_sample_rate} //= $ENV{SENTRY_TRACES_SAMPLE_RATE};
$options->{release} //= $ENV{SENTRY_RELEASE};
Expand Down
2 changes: 1 addition & 1 deletion t/snapshots/sdk_t/client_options
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}
},
'debug' => 1,
'default_integrations' => [],
'default_integrations' => 1,
'dsn' => 'abc',
'environment' => 'my env',
'release' => 'my release',
Expand Down
2 changes: 1 addition & 1 deletion t/snapshots/sdk_t/client_options_env_
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}, 'version' )
}
},
'default_integrations' => [],
'default_integrations' => 1,
'dsn' => 'DSN from env',
'environment' => 'environment from env',
'release' => 'release from env',
Expand Down