Class: Nunes::Subscribers::ActionController

Inherits:
Nunes::Subscriber show all
Defined in:
lib/nunes/subscribers/action_controller.rb

Constant Summary collapse

Pattern =

Private

/\.action_controller\Z/

Constants inherited from Nunes::Subscriber

Nunes::Subscriber::BANG

Instance Attribute Summary

Attributes inherited from Nunes::Subscriber

#adapter

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Nunes::Subscriber

#call, #increment, #initialize, subscribe, #timing

Constructor Details

This class inherits a constructor from Nunes::Subscriber

Class Method Details

.patternObject

Private: The namespace for events to subscribe to.



10
11
12
# File 'lib/nunes/subscribers/action_controller.rb', line 10

def self.pattern
  Pattern
end

Instance Method Details

#halted_callbackObject



67
68
69
# File 'lib/nunes/subscribers/action_controller.rb', line 67

def halted_callback(*)
  # noop
end

#process_action(start, ending, transaction_id, payload) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/nunes/subscribers/action_controller.rb', line 14

def process_action(start, ending, transaction_id, payload)
  controller = payload[:controller]
  action = payload[:action]
  status = payload[:status]
  exception_info = payload[:exception]

  format = payload[:format] || "all"
  format = "all" if format == "*/*"

  db_runtime = payload[:db_runtime]
  db_runtime = db_runtime.round if db_runtime

  view_runtime = payload[:view_runtime]
  view_runtime = view_runtime.round if view_runtime

  runtime = ((ending - start) * 1_000).round

  timing "action_controller.runtime.total", runtime
  timing "action_controller.runtime.view", view_runtime if view_runtime
  timing "action_controller.runtime.db",   db_runtime   if db_runtime

  increment "action_controller.format.#{format}" if format
  increment "action_controller.status.#{status}" if status

  if controller && action
    namespace = "action_controller.controller.#{controller}.#{action}"

    timing "#{namespace}.runtime.total",      runtime
    timing "#{namespace}.runtime.view", view_runtime if view_runtime
    timing "#{namespace}.runtime.db",   db_runtime   if db_runtime

    increment "#{namespace}.format.#{format}" if format
    increment "#{namespace}.status.#{status}" if status

  end

  if exception_info
    exception_class, exception_message = exception_info

    increment "action_controller.exception.#{exception_class}"
  end
end

#redirect_toObject



71
72
73
# File 'lib/nunes/subscribers/action_controller.rb', line 71

def redirect_to(*)
  # noop
end

#send_dataObject



79
80
81
# File 'lib/nunes/subscribers/action_controller.rb', line 79

def send_data(*)
  # noop
end

#send_fileObject



75
76
77
# File 'lib/nunes/subscribers/action_controller.rb', line 75

def send_file(*)
  # noop
end

#start_processingObject

All of the events below don’t really matter. Most of them also go # through process_action. The only value that could be pulled from them # would be topk related which graphite doesn’t do. #



63
64
65
# File 'lib/nunes/subscribers/action_controller.rb', line 63

def start_processing(*)
  # noop
end