airbrake_tools 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/Rakefile +5 -1
- data/Readme.md +5 -0
- data/lib/airbrake_tools.rb +16 -9
- data/lib/airbrake_tools/version.rb +1 -1
- data/spec/airbrake_tools_spec.rb +1 -1
- data/spec/fixtures.example.yml +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ca733d0ea934ee169bc869dcbb5e607d0da8255
|
4
|
+
data.tar.gz: 9c1fc1c27f60aaf801504dbce6b7e63d46fbd00f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1b5f1a7c3b41801c342ff9fb790211212f80f4cb9a9c8d747dfc568b12f6b4873085af9c4ac0d074c4de23d6141f8733301abab8e61d59506fd5a87667d4d56
|
7
|
+
data.tar.gz: c972e286e6c3194db26b7d0b9cbbfaa1de542fea2588e6fe42d70965c0d304428135935eaac7b161a6ae9b8fc0f0d12b3b0980e7e92bd8e373bbf93f08cd42c8
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
require "bump/tasks"
|
3
3
|
|
4
|
-
|
4
|
+
file "spec/fixtures.yml" => "spec/fixtures.example.yml" do
|
5
|
+
cp "spec/fixtures.example.yml", "spec/fixtures.yml"
|
6
|
+
end
|
7
|
+
|
8
|
+
task :default => "spec/fixtures.yml" do
|
5
9
|
sh "rspec spec/"
|
6
10
|
end
|
data/Readme.md
CHANGED
@@ -85,6 +85,11 @@ Mysql2::Error: Lost connection to MySQL server during reconnect
|
|
85
85
|
-v, --version Show Version
|
86
86
|
```
|
87
87
|
|
88
|
+
Development
|
89
|
+
======
|
90
|
+
In order for the specs to run, you need to copy `spec/fixtures.example.yml` to
|
91
|
+
`spec/features.yml` and edit to add your credentials.
|
92
|
+
|
88
93
|
Author
|
89
94
|
======
|
90
95
|
[Jonathan Cheatham](http://github.com/jcheatham)<br/>
|
data/lib/airbrake_tools.rb
CHANGED
@@ -6,11 +6,13 @@ require "launchy"
|
|
6
6
|
module AirbrakeTools
|
7
7
|
DEFAULT_HOT_PAGES = 1
|
8
8
|
DEFAULT_NEW_PAGES = 1
|
9
|
-
DEFAULT_SUMMARY_PAGES =
|
9
|
+
DEFAULT_SUMMARY_PAGES = 10
|
10
10
|
DEFAULT_COMPARE_DEPTH_ADDITION = 3 # first line in project is 6 -> compare at 6 + x depth
|
11
11
|
DEFAULT_ENVIRONMENT = "production"
|
12
12
|
COLORS = {
|
13
13
|
:gray => "\e[0;37m",
|
14
|
+
:green => "\e[0;32m",
|
15
|
+
:bold_white => "\e[1;37m",
|
14
16
|
:clear => "\e[0m"
|
15
17
|
}
|
16
18
|
|
@@ -62,7 +64,7 @@ module AirbrakeTools
|
|
62
64
|
|
63
65
|
def list(options)
|
64
66
|
page = 1
|
65
|
-
while errors = AirbrakeAPI.errors(:page => page)
|
67
|
+
while errors = AirbrakeAPI.errors(:page => page) and page <= DEFAULT_SUMMARY_PAGES
|
66
68
|
select_env(errors, options).each do |error|
|
67
69
|
puts "#{error.id} -- #{error.error_class} -- #{error.error_message} -- #{error.created_at}"
|
68
70
|
end
|
@@ -105,11 +107,8 @@ module AirbrakeTools
|
|
105
107
|
color = :gray if $stdout.tty? && !custom_file?(line)
|
106
108
|
line = line.sub("[PROJECT_ROOT]/", "")
|
107
109
|
line = add_blame(line)
|
108
|
-
|
109
|
-
|
110
|
-
else
|
111
|
-
line
|
112
|
-
end
|
110
|
+
|
111
|
+
color ? color_text(line, color) : line
|
113
112
|
end
|
114
113
|
|
115
114
|
def add_blame(backtrace_line)
|
@@ -166,6 +165,8 @@ module AirbrakeTools
|
|
166
165
|
[error, notices, frequency(notices, pages * AirbrakeAPI::Client::PER_PAGE)]
|
167
166
|
rescue Faraday::Error::ParsingError
|
168
167
|
$stderr.puts "Ignoring #{hot_summary(error)}, got 500 from http://#{AirbrakeAPI.account}.airbrake.io/errors/#{error.id}"
|
168
|
+
rescue Exception => e
|
169
|
+
puts "Ignoring exception <<#{e}>>, most likely bad data from airbrake"
|
169
170
|
end
|
170
171
|
end.compact
|
171
172
|
end
|
@@ -184,7 +185,9 @@ module AirbrakeTools
|
|
184
185
|
|
185
186
|
def print_errors(hot)
|
186
187
|
hot.each_with_index do |(error, notices, rate, deviance), index|
|
187
|
-
|
188
|
+
spark = sparkline(notices, :slots => 60, :interval => 60)
|
189
|
+
puts "\n##{(index+1).to_s.ljust(2)} #{rate.round(2).to_s.rjust(6)}/hour total:#{error.notices_count.to_s.ljust(8)} #{color_text(spark.ljust(61), :green)}"
|
190
|
+
puts hot_summary(error)
|
188
191
|
end
|
189
192
|
end
|
190
193
|
|
@@ -201,7 +204,11 @@ module AirbrakeTools
|
|
201
204
|
end
|
202
205
|
|
203
206
|
def hot_summary(error)
|
204
|
-
"id
|
207
|
+
"id: #{color_text(error.id, :bold_white)} -- first: #{color_text(error.created_at, :bold_white)} -- #{error.error_message}"
|
208
|
+
end
|
209
|
+
|
210
|
+
def color_text(text, color)
|
211
|
+
"#{COLORS[color]}#{text}#{COLORS[:clear]}"
|
205
212
|
end
|
206
213
|
|
207
214
|
def extract_options(argv)
|
data/spec/airbrake_tools_spec.rb
CHANGED
@@ -60,7 +60,7 @@ describe "airbrake-tools" do
|
|
60
60
|
|
61
61
|
describe "summary" do
|
62
62
|
it "kinda works" do
|
63
|
-
output = airbrake_tools("#{config["subdomain"]} #{config["auth_token"]} summary
|
63
|
+
output = airbrake_tools("#{config["subdomain"]} #{config["auth_token"]} summary #{config["summary_error_id"]} -p 1")
|
64
64
|
output.should include("last retrieved notice: ")
|
65
65
|
output.should include("last 2 hours: ")
|
66
66
|
end
|
data/spec/fixtures.example.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: airbrake_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Cheatham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: airbrake-api
|