Class: QueryTrack::EventProcessor
- Inherits:
-
Object
- Object
- QueryTrack::EventProcessor
- Defined in:
- lib/query_track/event_processor.rb
Instance Attribute Summary collapse
-
#event ⇒ Object
readonly
Returns the value of attribute event.
-
#subscriber ⇒ Object
readonly
Returns the value of attribute subscriber.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(event, subscriber) ⇒ EventProcessor
constructor
A new instance of EventProcessor.
Constructor Details
#initialize(event, subscriber) ⇒ EventProcessor
Returns a new instance of EventProcessor.
5 6 7 8 |
# File 'lib/query_track/event_processor.rb', line 5 def initialize(event, subscriber) @event = event @subscriber = subscriber end |
Instance Attribute Details
#event ⇒ Object (readonly)
Returns the value of attribute event.
3 4 5 |
# File 'lib/query_track/event_processor.rb', line 3 def event @event end |
#subscriber ⇒ Object (readonly)
Returns the value of attribute subscriber.
3 4 5 |
# File 'lib/query_track/event_processor.rb', line 3 def subscriber @subscriber end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/query_track/event_processor.rb', line 10 def call unsubscribe return unless QueryTrack::Settings.config.duration && QueryTrack::Settings.config.enabled return if under_filter?(caller) if duration_seconds > QueryTrack::Settings.config.duration QueryTrack::Notifications::Slack.new(event.payload[:sql], duration_seconds).call QueryTrack::Notifications::Log.new(event.payload[:sql], duration_seconds).call QueryTrack::Notifications::Custom.new(event.payload[:sql], duration_seconds).call end end |