Module: Sentry::Rails::Tracing
- Defined in:
- lib/sentry/rails/tracing.rb,
lib/sentry/rails/tracing/abstract_subscriber.rb,
lib/sentry/rails/tracing/action_view_subscriber.rb,
lib/sentry/rails/tracing/active_record_subscriber.rb,
lib/sentry/rails/tracing/active_storage_subscriber.rb,
lib/sentry/rails/tracing/active_support_subscriber.rb,
lib/sentry/rails/tracing/action_controller_subscriber.rb
Defined Under Namespace
Modules: SentryNotificationExtension
Classes: AbstractSubscriber, ActionControllerSubscriber, ActionViewSubscriber, ActiveRecordSubscriber, ActiveStorageSubscriber, ActiveSupportSubscriber
Constant Summary
collapse
- START_TIMESTAMP_NAME =
:sentry_start_timestamp
Class Method Summary
collapse
Class Method Details
.get_current_transaction ⇒ Object
71
72
73
|
# File 'lib/sentry/rails/tracing.rb', line 71
def self.get_current_transaction
Sentry.get_current_scope.get_transaction if Sentry.initialized?
end
|
.patch_active_support_notifications ⇒ Object
this is necessary because instrumentation events don’t record absolute start/finish time so we need to retrieve the correct time this way
.register_subscribers(subscribers) ⇒ Object
8
9
10
|
# File 'lib/sentry/rails/tracing.rb', line 8
def self.register_subscribers(subscribers)
@subscribers = subscribers
end
|
.remove_active_support_notifications_patch ⇒ Object
61
62
63
64
65
66
67
68
69
|
# File 'lib/sentry/rails/tracing.rb', line 61
def self.remove_active_support_notifications_patch
if ::ActiveSupport::Notifications::Instrumenter.ancestors.include?(SentryNotificationExtension)
SentryNotificationExtension.module_eval do
def instrument(name, payload = {}, &block)
super
end
end
end
end
|
.subscribe_tracing_events ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/sentry/rails/tracing.rb', line 20
def self.subscribe_tracing_events
return if @subscribed
subscribers.each do |subscriber|
subscriber.subscribe!
@subscribed_tracing_events ||= []
@subscribed_tracing_events += subscriber::EVENT_NAMES
end
@subscribed = true
end
|
.subscribed_tracing_events ⇒ Object
16
17
18
|
# File 'lib/sentry/rails/tracing.rb', line 16
def self.subscribed_tracing_events
@subscribed_tracing_events ||= []
end
|
.subscribers ⇒ Object
12
13
14
|
# File 'lib/sentry/rails/tracing.rb', line 12
def self.subscribers
@subscribers
end
|
.unsubscribe_tracing_events ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'lib/sentry/rails/tracing.rb', line 33
def self.unsubscribe_tracing_events
return unless @subscribed
subscribers.each(&:unsubscribe!)
subscribed_tracing_events.clear
@subscribed = false
end
|