airbrake_tools 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/Readme.md +1 -0
- data/lib/airbrake_tools/version.rb +1 -1
- data/lib/airbrake_tools.rb +6 -3
- metadata +1 -1
data/Gemfile.lock
CHANGED
data/Readme.md
CHANGED
@@ -75,6 +75,7 @@ Mysql2::Error: Lost connection to MySQL server during reconnect
|
|
75
75
|
### Options
|
76
76
|
|
77
77
|
```
|
78
|
+
-p, --pages NUM How maybe pages to iterate over (default: hot:1 summary:5)
|
78
79
|
-c, --compare-depth NUM At what level to compare backtraces (default: 7)
|
79
80
|
-e, --environment ENV Only show errors from this environment (default: production)
|
80
81
|
-h, --help Show this.
|
data/lib/airbrake_tools.rb
CHANGED
@@ -3,6 +3,8 @@ require "airbrake_tools/version"
|
|
3
3
|
require "airbrake-api"
|
4
4
|
|
5
5
|
module AirbrakeTools
|
6
|
+
DEFAULT_HOT_PAGES = 1
|
7
|
+
DEFAULT_SUMMARY_PAGES = 5
|
6
8
|
DEFAULT_COMPARE_DEPTH = 7
|
7
9
|
DEFAULT_ENVIRONMENT = "production"
|
8
10
|
|
@@ -34,7 +36,7 @@ module AirbrakeTools
|
|
34
36
|
end
|
35
37
|
|
36
38
|
def hot(options = {})
|
37
|
-
pages = (options[:pages] ||
|
39
|
+
pages = (options[:pages] || DEFAULT_HOT_PAGES).to_i
|
38
40
|
errors = []
|
39
41
|
pages.times do |i|
|
40
42
|
errors.concat(AirbrakeAPI.errors(:page => i+1) || [])
|
@@ -68,7 +70,7 @@ module AirbrakeTools
|
|
68
70
|
|
69
71
|
def summary(error_id, options)
|
70
72
|
compare_depth = options[:compare_depth] || DEFAULT_COMPARE_DEPTH
|
71
|
-
notices = AirbrakeAPI.notices(error_id, :pages =>
|
73
|
+
notices = AirbrakeAPI.notices(error_id, :pages => options[:pages] || DEFAULT_SUMMARY_PAGES)
|
72
74
|
|
73
75
|
puts "last retrieved notice: #{((Time.now - notices.last.created_at) / (60 * 60)).round} hours ago at #{notices.last.created_at}"
|
74
76
|
puts "last 2 hours: #{sparkline(notices, :slots => 60, :interval => 120)}"
|
@@ -127,7 +129,8 @@ module AirbrakeTools
|
|
127
129
|
|
128
130
|
Options:
|
129
131
|
BANNER
|
130
|
-
opts.on("-c NUM", "--compare-depth NUM", Integer, "How deep to compare backtraces (default: #{DEFAULT_COMPARE_DEPTH})") {|s| options[:env] = s }
|
132
|
+
opts.on("-c NUM", "--compare-depth NUM", Integer, "How deep to compare backtraces in summary (default: #{DEFAULT_COMPARE_DEPTH})") {|s| options[:env] = s }
|
133
|
+
opts.on("-p NUM", "--pages NUM", Integer, "How maybe pages to iterate over (default: hot:#{DEFAULT_HOT_PAGES} summary:#{DEFAULT_SUMMARY_PAGES})") {|s| options[:env] = s }
|
131
134
|
opts.on("-e ENV", "--environment ENV", String, "Only show errors from this environment (default: #{DEFAULT_ENVIRONMENT})") {|s| options[:env] = s }
|
132
135
|
opts.on("-h", "--help", "Show this.") { puts opts; exit }
|
133
136
|
opts.on("-v", "--version", "Show Version"){ puts "airbrake-tools #{VERSION}"; exit }
|