Skip to content

Commit d6ba93f

Browse files
committed
Get rid of NoopProfiler and just augment profiling_enabled? check
1 parent 227e5d3 commit d6ba93f

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

sentry-ruby/lib/sentry/profiler.rb

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,7 @@
33
require 'securerandom'
44

55
module Sentry
6-
class NoopProfiler
7-
def initialize(_configuration); end
8-
def start; end
9-
def stop; end
10-
def set_initial_sample_decision(_transaction_sampled); end
11-
12-
def profile_context
13-
{}
14-
end
15-
16-
def to_hash
17-
{}
18-
end
19-
end
20-
21-
class StackProfProfiler < NoopProfiler
6+
class Profiler
227
VERSION = '1'
238
PLATFORM = 'ruby'
249
# 101 Hz in microseconds
@@ -32,7 +17,7 @@ def initialize(configuration)
3217
@started = false
3318
@sampled = nil
3419

35-
@profiling_enabled = configuration.profiling_enabled?
20+
@profiling_enabled = defined?(StackProf) && configuration.profiling_enabled?
3621
@profiles_sample_rate = configuration.profiles_sample_rate
3722
@project_root = configuration.project_root
3823
@app_dirs_pattern = configuration.app_dirs_pattern || Backtrace::APP_DIRS_PATTERN
@@ -238,6 +223,4 @@ def split_module(name)
238223
[function, mod]
239224
end
240225
end
241-
242-
Profiler = defined?(StackProf) ? StackProfProfiler : NoopProfiler
243226
end

0 commit comments

Comments
 (0)