Skip to content
Merged
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
28 changes: 2 additions & 26 deletions sentry-ruby/lib/sentry/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ def include_local_variables=(value)

# these are not config options
# @!visibility private
attr_reader :errors, :gem_specs
attr_reader :gem_specs

# These exceptions could enter Puma's `lowlevel_error_handler` callback and the SDK's Puma integration
# But they are mostly considered as noise and should be ignored by default
Expand Down Expand Up @@ -764,9 +764,7 @@ def sending_allowed?
end

def sending_to_dsn_allowed?
@errors = []

valid? && capture_in_environment?
!!@dsn&.valid? && enabled_in_current_env?
end

def sample_allowed?
Expand Down Expand Up @@ -856,12 +854,6 @@ def detect_release
log_error("Error detecting release", e, debug: debug)
end

# @api private
def error_messages
@errors = [@errors[0]] + @errors[1..-1].map(&:downcase) # fix case of all but first
@errors.join(", ")
end

# @api private
def run_after_close_callbacks
run_callbacks(:after, :closed)
Expand Down Expand Up @@ -908,22 +900,6 @@ def safe_const_get(x)
nil
end

def capture_in_environment?
return true if enabled_in_current_env?

@errors << "Not configured to send/capture in environment '#{environment}'"
false
end

def valid?
if @dsn&.valid?
true
else
@errors << "DSN not set or not valid"
false
end
end

def environment_from_env
ENV["SENTRY_CURRENT_ENV"] || ENV["SENTRY_ENVIRONMENT"] || ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development"
end
Expand Down
3 changes: 0 additions & 3 deletions sentry-ruby/spec/sentry/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -476,13 +476,11 @@
it 'should send events if test is whitelisted' do
subject.enabled_environments = %w[test]
expect(subject.sending_allowed?).to eq(true)
expect(subject.errors).to be_empty
end

it 'should not send events if test is not whitelisted' do
subject.enabled_environments = %w[not_test]
expect(subject.sending_allowed?).to eq(false)
expect(subject.errors).to eq(["Not configured to send/capture in environment 'test'"])
end
end

Expand Down Expand Up @@ -551,7 +549,6 @@

it 'captured_allowed returns false' do
expect(subject.sending_allowed?).to eq(false)
expect(subject.errors).to eq(["DSN not set or not valid"])
end
end

Expand Down
Loading