Commit 9e06ff0fd83f787b8c9378a260a69993b67d0505
1 parent
24958c80
Exists in
master
and in
1 other branch
Fixed migrations
Showing
2 changed files
with
22 additions
and
12 deletions
Show diff stats
app/models/backtrace_line_normalizer.rb
@@ -9,11 +9,19 @@ class BacktraceLineNormalizer | @@ -9,11 +9,19 @@ class BacktraceLineNormalizer | ||
9 | 9 | ||
10 | private | 10 | private |
11 | def normalized_file | 11 | def normalized_file |
12 | - @raw_line['file'].blank? ? "[unknown source]" : @raw_line['file'].to_s.gsub(/\[PROJECT_ROOT\]\/.*\/ruby\/[0-9.]+\/gems/, '[GEM_ROOT]/gems') | 12 | + if @raw_line['file'].blank? |
13 | + "[unknown source]" | ||
14 | + else | ||
15 | + @raw_line['file'].to_s.gsub(/\[PROJECT_ROOT\]\/.*\/ruby\/[0-9.]+\/gems/, '[GEM_ROOT]/gems') | ||
16 | + end | ||
13 | end | 17 | end |
14 | 18 | ||
15 | def normalized_method | 19 | def normalized_method |
16 | - @raw_line['method'].blank? ? "[unknown method]" : @raw_line['method'].gsub(/[0-9_]{10,}+/, "__FRAGMENT__") | 20 | + if @raw_line['method'].blank? |
21 | + "[unknown method]" | ||
22 | + else | ||
23 | + @raw_line['method'].to_s.gsub(/[0-9_]{10,}+/, "__FRAGMENT__") | ||
24 | + end | ||
17 | end | 25 | end |
18 | 26 | ||
19 | end | 27 | end |
db/migrate/20121005142110_regenerate_err_fingerprints.rb
1 | class RegenerateErrFingerprints < Mongoid::Migration | 1 | class RegenerateErrFingerprints < Mongoid::Migration |
2 | def self.up | 2 | def self.up |
3 | Err.all.each do |err| | 3 | Err.all.each do |err| |
4 | - fingerprint_source = { | ||
5 | - :backtrace => err.notices.first.backtrace_id, | ||
6 | - :error_class => err.error_class, | ||
7 | - :component => err.component, | ||
8 | - :action => err.action, | ||
9 | - :environment => err.environment, | ||
10 | - :api_key => err.app.api_key | ||
11 | - } | ||
12 | - fingerprint = Digest::SHA1.hexdigest(fingerprint_source.to_s) | ||
13 | - err.update_attribute(:fingerprint, fingerprint) | 4 | + if err.notices.any? |
5 | + fingerprint_source = { | ||
6 | + :backtrace => err.notices.first.backtrace_id, | ||
7 | + :error_class => err.error_class, | ||
8 | + :component => err.component, | ||
9 | + :action => err.action, | ||
10 | + :environment => err.environment, | ||
11 | + :api_key => err.app.api_key | ||
12 | + } | ||
13 | + fingerprint = Digest::SHA1.hexdigest(fingerprint_source.to_s) | ||
14 | + err.update_attribute(:fingerprint, fingerprint) | ||
15 | + end | ||
14 | end | 16 | end |
15 | end | 17 | end |
16 | 18 |