Skip to content

Commit e99575b

Browse files
committed
Try to debug this shit
1 parent cc8a4af commit e99575b

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

sentry-ruby/lib/sentry/profiler.rb

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class StackProfProfiler < NoopProfiler
2626
MICRO_TO_NANO_SECONDS = 1e3
2727

2828
attr_reader :sampled, :started, :event_id
29+
attr_reader :results
2930

3031
def initialize(configuration)
3132
@event_id = SecureRandom.uuid.delete('-')
@@ -96,6 +97,7 @@ def to_hash
9697
return {} unless @started
9798

9899
results = StackProf.results
100+
@results = results
99101
return {} unless results
100102
return {} if results.empty?
101103
return {} if results[:samples] == 0

sentry-ruby/lib/sentry/transaction_event.rb

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ class TransactionEvent < Event
2020
# @return [Hash, nil]
2121
attr_accessor :profile
2222

23+
# TODO-neel remove
24+
attr_reader :profiler
25+
2326
def initialize(transaction:, **options)
2427
super(**options)
2528

@@ -36,6 +39,8 @@ def initialize(transaction:, **options)
3639
finished_spans = transaction.span_recorder.spans.select { |span| span.timestamp && span != transaction }
3740
self.spans = finished_spans.map(&:to_hash)
3841

42+
# TODO-neel remove
43+
@profiler = transaction.profiler
3944
populate_profile(transaction)
4045
end
4146

sentry-ruby/spec/sentry/rack/capture_exceptions_spec.rb

+6
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,8 @@ def will_be_sampled_by_sdk
658658
end
659659
end
660660

661+
before { StackProf.stop }
662+
661663
it "collects a profile" do
662664
app = ->(_) do
663665
[200, {}, [TestApp.foo]]
@@ -667,6 +669,10 @@ def will_be_sampled_by_sdk
667669
stack.call(env)
668670
event = last_sentry_event
669671

672+
# TODO-neel debugging
673+
expect(defined?(StackProf)).to eq("constant")
674+
puts("NEEL: " + event.profiler.inspect)
675+
670676
profile = event.profile
671677
expect(profile).not_to be_nil
672678

0 commit comments

Comments
 (0)