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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
- Remove `:monotonic_active_support_logger` from `config.breadcrumbs_logger` ([#2717](https://github.com/getsentry/sentry-ruby/pull/2717))
- Requests which have response status codes in the inclusive ranges `[(301..303), (305..399), (401..404)]` will no longer create transactions by default. See `config.trace_ignore_status_codes` below to control what gets traced.
- Remove deprecated `config.capture_exception_frame_locals`, use `include_local_variables` instead ([#2730](https://github.com/getsentry/sentry-ruby/pull/2730))
- Remove deprecated `config.enable_tracing`, use `config.traces_sample_rate = 1.0` instead ([#2731](https://github.com/getsentry/sentry-ruby/pull/2731))
- Remove deprecated `config.logger=`, use `config.sdk_logger=` instead ([#2732](https://github.com/getsentry/sentry-ruby/pull/2732))
- Remove deprecated `Sentry::Rails::Tracing::ActionControllerSubscriber` ([#2733](https://github.com/getsentry/sentry-ruby/pull/2733))

### Features

Expand Down
2 changes: 1 addition & 1 deletion sentry-rails/benchmarks/allocation_comparison.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
end

app = create_app do |config|
config.logger = ::Logger.new(STDOUT)
config.sdk_logger = ::Logger.new(STDOUT)
config.transport.transport_class = Sentry::BenchmarkTransport
config.breadcrumbs_logger = [:active_support_logger]
end
Expand Down
2 changes: 1 addition & 1 deletion sentry-rails/benchmarks/allocation_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
end

app = create_app do |config|
config.logger = ::Logger.new(STDOUT)
config.sdk_logger = ::Logger.new(STDOUT)
config.transport.transport_class = Sentry::BenchmarkTransport
config.breadcrumbs_logger = [:active_support_logger]
end
Expand Down
2 changes: 1 addition & 1 deletion sentry-rails/examples/minimum-rails/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

Sentry.init do |config|
config.dsn = 'https://2fb45f003d054a7ea47feb45898f7649@o447951.ingest.sentry.io/5434472'
config.logger = Logger.new($stdout)
config.sdk_logger = Logger.new($stdout)
end

ActiveSupport::Deprecation.silenced = true
Expand Down
1 change: 0 additions & 1 deletion sentry-rails/lib/sentry/rails/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# frozen_string_literal: true

require "sentry/rails/tracing/action_controller_subscriber"
require "sentry/rails/tracing/action_view_subscriber"
require "sentry/rails/tracing/active_record_subscriber"
require "sentry/rails/tracing/active_storage_subscriber"
Expand Down
15 changes: 0 additions & 15 deletions sentry-rails/lib/sentry/rails/instrument_payload_cleanup_helper.rb

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion sentry-ruby/benchmarks/allocation_comparison.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require "sentry/benchmarks/benchmark_transport"

Sentry.init do |config|
config.logger = ::Logger.new(nil)
config.sdk_logger = ::Logger.new(nil)
config.dsn = "dummy://12345:67890@sentry.localdomain:3000/sentry/42"
config.transport.transport_class = Sentry::BenchmarkTransport
config.breadcrumbs_logger = [:sentry_logger]
Expand Down
2 changes: 1 addition & 1 deletion sentry-ruby/benchmarks/allocation_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require "sentry/benchmarks/benchmark_transport"

Sentry.init do |config|
config.logger = ::Logger.new(nil)
config.sdk_logger = ::Logger.new(nil)
config.dsn = "dummy://12345:67890@sentry.localdomain:3000/sentry/42"
config.transport.transport_class = Sentry::BenchmarkTransport
config.breadcrumbs_logger = [:sentry_logger]
Expand Down
32 changes: 1 addition & 31 deletions sentry-ruby/lib/sentry/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,6 @@ class Configuration
# @return [String, nil]
attr_accessor :sdk_debug_transport_log_file

# @deprecated Use {#sdk_logger=} instead.
def logger=(logger)
warn "[sentry] `config.logger=` is deprecated. Please use `config.sdk_logger=` instead."
self.sdk_logger = logger
end

# @deprecated Use {#sdk_logger} instead.
def logger
warn "[sentry] `config.logger` is deprecated. Please use `config.sdk_logger` instead."
self.sdk_logger
end

# Project directory root for in_app detection. Could be Rails root, etc.
# Set automatically for Rails.
# @return [String]
Expand Down Expand Up @@ -290,12 +278,6 @@ def logger
# @return [StructuredLoggingConfiguration]
attr_reader :structured_logging

# Easier way to use performance tracing
# If set to true, will set traces_sample_rate to 1.0
# @deprecated It will be removed in the next major release.
# @return [Boolean, nil]
attr_reader :enable_tracing

# Send diagnostic client reports about dropped events, true by default
# tries to attach to an existing envelope max once every 30s
# @return [Boolean]
Expand Down Expand Up @@ -512,7 +494,6 @@ def initialize
self.before_send_log = nil
self.rack_env_whitelist = RACK_ENV_WHITELIST_DEFAULT
self.traces_sampler = nil
self.enable_tracing = nil
self.enable_logs = false

self.profiler_class = Sentry::Profiler
Expand Down Expand Up @@ -615,17 +596,6 @@ def trace_ignore_status_codes=(codes)
@trace_ignore_status_codes = codes
end

def enable_tracing=(enable_tracing)
unless enable_tracing.nil?
log_warn <<~MSG
`enable_tracing` is now deprecated in favor of `traces_sample_rate = 1.0`.
MSG
end

@enable_tracing = enable_tracing
@traces_sample_rate ||= 1.0 if enable_tracing
end

def traces_sample_rate=(traces_sample_rate)
@traces_sample_rate = traces_sample_rate
end
Expand Down Expand Up @@ -690,7 +660,7 @@ def valid_sample_rate?(sample_rate)
def tracing_enabled?
valid_sampler = !!((valid_sample_rate?(@traces_sample_rate)) || @traces_sampler)

(@enable_tracing != false) && valid_sampler && sending_allowed?
valid_sampler && sending_allowed?
end

def profiling_enabled?
Expand Down
77 changes: 3 additions & 74 deletions sentry-ruby/spec/sentry/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,25 +91,6 @@
expect(subject.tracing_enabled?).to eq(false)
end
end

context "when enable_tracing is set" do
it "returns false" do
subject.enable_tracing = true

expect(subject.tracing_enabled?).to eq(false)
end

it "prints deprecation message when being assigned" do
string_io = StringIO.new
subject.logger = Logger.new(string_io)

subject.enable_tracing = true

expect(string_io.string).to include(
"WARN -- sentry: `enable_tracing` is now deprecated in favor of `traces_sample_rate = 1.0`."
)
end
end
end

context "when sending allowed" do
Expand Down Expand Up @@ -152,29 +133,6 @@
expect(subject.tracing_enabled?).to eq(true)
end
end

context "when enable_tracing is true" do
it "returns true" do
subject.enable_tracing = true

expect(subject.tracing_enabled?).to eq(true)
end
end

context "when enable_tracing is false" do
it "returns false" do
subject.enable_tracing = false

expect(subject.tracing_enabled?).to eq(false)
end

it "returns false even with explicit traces_sample_rate" do
subject.traces_sample_rate = 1.0
subject.enable_tracing = false

expect(subject.tracing_enabled?).to eq(false)
end
end
end
end

Expand Down Expand Up @@ -204,19 +162,19 @@

describe "#profiling_enabled?" do
it "returns false unless tracing enabled" do
subject.enable_tracing = false
subject.traces_sample_rate = nil
expect(subject.profiling_enabled?).to eq(false)
end

it "returns false unless sending enabled" do
subject.enable_tracing = true
subject.traces_sample_rate = 1.0
subject.profiles_sample_rate = 1.0
allow(subject).to receive(:sending_allowed?).and_return(false)
expect(subject.profiling_enabled?).to eq(false)
end

context 'when tracing and sending enabled' do
before { subject.enable_tracing = true }
before { subject.traces_sample_rate = 1.0 }
before { allow(subject).to receive(:sending_allowed?).and_return(true) }

it "returns false if nil sample rate" do
Expand All @@ -236,19 +194,6 @@
end
end

describe "#enable_tracing=" do
it "sets traces_sample_rate to 1.0 automatically" do
subject.enable_tracing = true
expect(subject.traces_sample_rate).to eq(1.0)
end

it "doesn't override existing traces_sample_rate" do
subject.traces_sample_rate = 0.5
subject.enable_tracing = true
expect(subject.traces_sample_rate).to eq(0.5)
end
end

describe "#transport" do
it "returns an initialized Transport::Configuration object" do
transport_config = subject.transport
Expand Down Expand Up @@ -767,22 +712,6 @@ class SentryConfigurationSample < Sentry::Configuration
end
end

describe "#logger" do
it "returns configured sdk_logger and prints deprecation warning" do
expect {
expect(subject.logger).to be(subject.sdk_logger)
}.to output(/`config.logger` is deprecated/).to_stderr
end
end

describe "#logger=" do
it "sets sdk_logger and prints deprecation warning" do
expect {
subject.logger = Logger.new($stdout)
}.to output(/`config.logger=` is deprecated/).to_stderr
end
end

describe "#trace_ignore_status_codes" do
it "has default values" do
expect(subject.trace_ignore_status_codes).to eq([(301..303), (305..399), (401..404)])
Expand Down
Loading