Module: Telegram::Bot::UpdatesController::Instrumentation
- Included in:
- Telegram::Bot::UpdatesController
- Defined in:
- lib/telegram/bot/updates_controller/instrumentation.rb
Overview
Most methods are taken from ActionController::Instrumentation, some are slightly modified.
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.instrument(action, *args, &block) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/telegram/bot/updates_controller/instrumentation.rb', line 13 def instrument(action, *args, &block) ActiveSupport::Notifications.instrument( "#{action}.updates_controller.bot.telegram", *args, &block ) end |
.prepended(base) ⇒ Object
8 9 10 11 |
# File 'lib/telegram/bot/updates_controller/instrumentation.rb', line 8 def prepended(base) base.send :config_accessor, :logger base.extend ClassMethods end |
Instance Method Details
#process_action(*args) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/telegram/bot/updates_controller/instrumentation.rb', line 22 def process_action(*args) raw_payload = { controller: self.class.name, action: action_name, update: update, } Instrumentation.instrument(:start_processing, raw_payload.dup) Instrumentation.instrument(:process_action, raw_payload) do |payload| begin super ensure append_info_to_payload(payload) end end end |
#respond_with(type) ⇒ Object
38 39 40 |
# File 'lib/telegram/bot/updates_controller/instrumentation.rb', line 38 def respond_with(type, *) Instrumentation.instrument(:respond_with, type: type) { super } end |