module Telegram::Bot::UpdatesController::Instrumentation

Most methods are taken from ActionController::Instrumentation, some are slightly modified.

Public Class Methods

instrument(action, *args, &block) click to toggle source
# File lib/telegram/bot/updates_controller/instrumentation.rb, line 14
def instrument(action, *args, &block)
  ActiveSupport::Notifications.instrument(
    "#{action}.updates_controller.bot.telegram",
    *args,
    &block
  )
end

Public Instance Methods

process_action(*args) click to toggle source
Calls superclass method
# File lib/telegram/bot/updates_controller/instrumentation.rb, line 23
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, *) click to toggle source
Calls superclass method
# File lib/telegram/bot/updates_controller/instrumentation.rb, line 39
def respond_with(type, *)
  Instrumentation.instrument(:respond_with, type: type) { super }
end

Private Instance Methods

halted_callback_hook(filter, *) click to toggle source

A hook invoked every time a before callback is halted.

# File lib/telegram/bot/updates_controller/instrumentation.rb, line 52
def halted_callback_hook(filter, *)
  Instrumentation.instrument(:halted_callback, filter: filter)
end