Module: Resque::Plugins::CloudwatchMonitor
- Defined in:
- lib/resque/plugins/cloudwatch-monitor/version.rb,
lib/resque/plugins/cloudwatch-monitor/configuration.rb,
lib/resque/plugins/cloudwatch-monitor/cloudwatch-monitor.rb
Defined Under Namespace
Modules: Configuration
Constant Summary collapse
- VERSION =
'0.0.2'
Instance Method Summary collapse
- #before_perform_report_cw(*args) ⇒ Object
-
#dimensions(*args) ⇒ Object
Array of dimensions for Cloudwatch.
-
#fail_namespace ⇒ Object
Cloudwatch Custom Metric Namespace For Failed Jobs.
-
#metric_name ⇒ Object
Cloudwatch metric name.
-
#namespace ⇒ Object
Cloudwatch Custom Metric Namespace.
-
#on_failure_report_cw(e, *args) ⇒ Object
Job on failure hook.
-
#perform_namespace ⇒ Object
Cloudwatch Custom Metric Namespace For Before Performed Jobs.
-
#timestamp ⇒ Object
Metric timestamp.
-
#unit ⇒ Object
Cloudwatch metric unit type.
-
#value ⇒ Object
Cloudwatch metric value.
Instance Method Details
#before_perform_report_cw(*args) ⇒ Object
52 53 54 55 |
# File 'lib/resque/plugins/cloudwatch-monitor/cloudwatch-monitor.rb', line 52 def before_perform_report_cw(*args) report_dimensions = dimensions(*args) report(perform_namespace, metric_name, report_dimensions) end |
#dimensions(*args) ⇒ Object
Array of dimensions for Cloudwatch
27 28 29 |
# File 'lib/resque/plugins/cloudwatch-monitor/cloudwatch-monitor.rb', line 27 def dimensions(*args) [] end |
#fail_namespace ⇒ Object
Cloudwatch Custom Metric Namespace For Failed Jobs
12 13 14 |
# File 'lib/resque/plugins/cloudwatch-monitor/cloudwatch-monitor.rb', line 12 def fail_namespace Configuration.fail_namespace end |
#metric_name ⇒ Object
Cloudwatch metric name
22 23 24 |
# File 'lib/resque/plugins/cloudwatch-monitor/cloudwatch-monitor.rb', line 22 def metric_name @queue || queue end |
#namespace ⇒ Object
Cloudwatch Custom Metric Namespace
7 8 9 |
# File 'lib/resque/plugins/cloudwatch-monitor/cloudwatch-monitor.rb', line 7 def namespace Configuration.namespace end |
#on_failure_report_cw(e, *args) ⇒ Object
Job on failure hook. receives the job arguments and the exception
47 48 49 50 |
# File 'lib/resque/plugins/cloudwatch-monitor/cloudwatch-monitor.rb', line 47 def on_failure_report_cw(e, *args) report_dimensions = dimensions(*args) report(fail_namespace, metric_name, report_dimensions) end |
#perform_namespace ⇒ Object
Cloudwatch Custom Metric Namespace For Before Performed Jobs
17 18 19 |
# File 'lib/resque/plugins/cloudwatch-monitor/cloudwatch-monitor.rb', line 17 def perform_namespace Configuration.perform_namespace end |
#timestamp ⇒ Object
Metric timestamp
32 33 34 |
# File 'lib/resque/plugins/cloudwatch-monitor/cloudwatch-monitor.rb', line 32 def Time.now.iso8601 end |
#unit ⇒ Object
Cloudwatch metric unit type
37 38 39 |
# File 'lib/resque/plugins/cloudwatch-monitor/cloudwatch-monitor.rb', line 37 def unit 'Count' end |
#value ⇒ Object
Cloudwatch metric value
42 43 44 |
# File 'lib/resque/plugins/cloudwatch-monitor/cloudwatch-monitor.rb', line 42 def value 1 end |