Class: Sentry::Rails::Tracing::AbstractSubscriber
- Inherits:
-
Object
- Object
- Sentry::Rails::Tracing::AbstractSubscriber
show all
- Defined in:
- lib/sentry/rails/tracing/abstract_subscriber.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.record_on_current_span(duration:, **options) ⇒ Object
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/sentry/rails/tracing/abstract_subscriber.rb', line 41
def record_on_current_span(duration:, **options)
return unless options[:start_timestamp]
Sentry.with_child_span(**options) do |child_span|
child_span.set_timestamp(child_span.start_timestamp + duration / 1000)
yield(child_span) if block_given?
end
end
|
.subscribe! ⇒ Object
8
9
10
|
# File 'lib/sentry/rails/tracing/abstract_subscriber.rb', line 8
def subscribe!
raise NotImplementedError
end
|
.unsubscribe! ⇒ Object
12
13
14
15
16
|
# File 'lib/sentry/rails/tracing/abstract_subscriber.rb', line 12
def unsubscribe!
self::EVENT_NAMES.each do |name|
ActiveSupport::Notifications.unsubscribe(name)
end
end
|
Instance Method Details
#subscribe_to_event(event_names) ⇒ Object
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/sentry/rails/tracing/abstract_subscriber.rb', line 19
def subscribe_to_event(event_names)
event_names.each do |event_name|
ActiveSupport::Notifications.subscribe(event_name) do |*args|
next unless Tracing.get_current_transaction
event = ActiveSupport::Notifications::Event.new(*args)
yield(event_name, event.duration, event.payload)
end
end
end
|