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, Nunes::Subscriber::DOT

Class Attribute Summary collapse

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 Attribute Details

.instrument_db_runtimeObject

Returns the value of attribute instrument_db_runtime.



17
18
19
# File 'lib/nunes/subscribers/action_controller.rb', line 17

def instrument_db_runtime
  @instrument_db_runtime
end

.instrument_formatObject

Returns the value of attribute instrument_format.



15
16
17
# File 'lib/nunes/subscribers/action_controller.rb', line 15

def instrument_format
  @instrument_format
end

.instrument_view_runtimeObject

Returns the value of attribute instrument_view_runtime.



16
17
18
# File 'lib/nunes/subscribers/action_controller.rb', line 16

def instrument_view_runtime
  @instrument_view_runtime
end

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



94
95
96
# File 'lib/nunes/subscribers/action_controller.rb', line 94

def halted_callback(*)
  # noop
end

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



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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/nunes/subscribers/action_controller.rb', line 29

def process_action(start, ending, transaction_id, payload)
  runtime = ((ending - start) * 1_000).round
  timing "action_controller.runtime.total", runtime

  status = payload[:status]
  increment "action_controller.status.#{status}" if status

  controller = ::Nunes.class_to_metric(payload[:controller])
  action = payload[:action]

  if controller && action
    timing "action_controller.controller.#{controller}.#{action}.runtime.total", runtime
    increment "action_controller.controller.#{controller}.#{action}.status.#{status}" if status
  end

  if self.class.instrument_view_runtime
    view_runtime = payload[:view_runtime]
    view_runtime = view_runtime.round if view_runtime

    if view_runtime
      timing "action_controller.runtime.view", view_runtime

      if controller && action
        timing "action_controller.controller.#{controller}.#{action}.runtime.view", view_runtime
      end
    end
  end

  if self.class.instrument_db_runtime
    db_runtime = payload[:db_runtime]
    db_runtime = db_runtime.round if db_runtime

    if db_runtime
      timing "action_controller.runtime.db", db_runtime

      if controller && action
        timing "action_controller.controller.#{controller}.#{action}.runtime.db", db_runtime
      end
    end
  end

  if self.class.instrument_format
    format = payload[:format] || "all"
    format = "all" if format == "*/*"

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

      if controller && action
        increment "action_controller.controller.#{controller}.#{action}.format.#{format}"
      end
    end
  end
end

#redirect_toObject



98
99
100
# File 'lib/nunes/subscribers/action_controller.rb', line 98

def redirect_to(*)
  # noop
end

#send_dataObject



106
107
108
# File 'lib/nunes/subscribers/action_controller.rb', line 106

def send_data(*)
  # noop
end

#send_fileObject



102
103
104
# File 'lib/nunes/subscribers/action_controller.rb', line 102

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. #



90
91
92
# File 'lib/nunes/subscribers/action_controller.rb', line 90

def start_processing(*)
  # noop
end