errdo 0.12.0 → 0.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4116e90f72c32acdffad213a308e7ff11f43c01b
4
- data.tar.gz: c4cf490f849f5739e9524a25942adf5f91535890
3
+ metadata.gz: d31dc6f2561711decdfed508abfa52d7861ce150
4
+ data.tar.gz: 6f83b1ae3edcec3a80f31ab10706ddd330378634
5
5
  SHA512:
6
- metadata.gz: 39f04a65ec0cc8043f2e1b0cd754e468196b362370460c2fa4ac4ad32f6b9fc2a36b66bdfe28b62100eb75eaa6be5857f00a5985eb0cedac8e281825aedfc02f
7
- data.tar.gz: 6606efd12bb3ac9a0716eb773f8147a6a7e0bfb35fc22bbfaa8f1df4c6afcc75f3f7dad0a26563bfd6bf1a30ee81350c616f1982f0e19aa5e1b2730881f3b540
6
+ metadata.gz: 6b8ca017cbfc3c3907dccb1971b2025e5ac4e185afb2fd0287a5bb5aee0c54aac1ed78b4f80588e315867526f5be590f131e2652f612187ddd6cf87ba55ff188
7
+ data.tar.gz: e77f579acbb26c895ac7973fb4256a4c75bd4c300fd24dec8de9543519f3d7c02df115e00874ee89e969ee5ee5e396df5701d8b1cb0b8feb46b4ed97b82ab0c2
@@ -7,8 +7,10 @@ module Errdo
7
7
 
8
8
  error = nil
9
9
  error = create_errors(@env_parser) unless Errdo.error_name.blank?
10
- Errdo.notify_with.each do |notifier|
11
- notifier.notify(@env_parser, error: error)
10
+ unless too_soon? error
11
+ Errdo.notify_with.each do |notifier|
12
+ notifier.notify(@env_parser, error: error)
13
+ end
12
14
  end
13
15
  end
14
16
 
@@ -20,5 +22,15 @@ module Errdo
20
22
  return error
21
23
  end
22
24
 
25
+ def too_soon?(error)
26
+ return false if error.nil?
27
+
28
+ last_occurrence = error.error_occurrences.offset(1).order("created_at asc").last
29
+ if last_occurrence && Errdo.ignore_time && last_occurrence.created_at > (Time.current - Errdo.ignore_time)
30
+ return true
31
+ end
32
+ return false
33
+ end
34
+
23
35
  end
24
36
  end
data/lib/errdo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Errdo
2
- VERSION = '0.12.0'.freeze
2
+ VERSION = '0.12.1'.freeze
3
3
  end
data/lib/errdo.rb CHANGED
@@ -44,6 +44,9 @@ module Errdo
44
44
 
45
45
  mattr_accessor :log404
46
46
  @@log404 = false
47
+
48
+ mattr_accessor :ignore_time
49
+ @@ignore_time = 5.minutes
47
50
  # rubocop:enable Style/ClassVars
48
51
 
49
52
  # == Authentication ==
@@ -7,6 +7,11 @@ Errdo.setup do |config|
7
7
  # By default, 404 errors are ignored. To un-ignore them, set this to true
8
8
  # config.log404 = true
9
9
 
10
+ # By default, errors are ignored (for notification only) if they happen
11
+ # within 5 minutes of the last identical error.
12
+ # This can be changed by setting
13
+ # config.ignore_time = 5.minutes
14
+
10
15
  ## == Authorization and Devise integration =========
11
16
  # If you have the ability to track who's logged in, setting the current_user_method
12
17
  # will allow the logged-in user to be recorded with the error
@@ -44,7 +49,7 @@ Errdo.setup do |config|
44
49
  # If you want to set up slack, this is the only required parameter.
45
50
  # The rest are totally optional, and default to the values here
46
51
  #
47
- # Errdo.notify_with slack: { webhook: "WEBHOOK-URL",
52
+ # config.notify_with slack: { webhook: "WEBHOOK-URL",
48
53
  # channel: nil
49
54
  # icon: ":boom:",
50
55
  # name: "Errdo-bot" }
@@ -52,5 +57,5 @@ Errdo.setup do |config|
52
57
 
53
58
  ## == Non Web Requests ============================
54
59
  # Error logging for rake tasks is on by default. To turn it off, set
55
- # Errdo.log_task_exceptions = false
60
+ # config.log_task_exceptions = false
56
61
  end
Binary file
Binary file
@@ -49685,3 +49685,41 @@ X-Content-Type-Options: nosniff
49685
49685
  FROM sqlite_temp_master
49686
49686
  WHERE name='index_users_on_email' AND type='index'
49687
49687
  
49688
+
49689
+
49690
+ Started GET "/" for 127.0.0.1 at 2016-11-20 16:15:38 -0500
49691
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
49692
+ Processing by StaticController#home as HTML
49693
+ Rendered static/home.html.erb (0.3ms)
49694
+ Completed 200 OK in 6ms (Views: 5.7ms | ActiveRecord: 0.0ms)
49695
+
49696
+
49697
+ Started GET "/static/generic_error" for 127.0.0.1 at 2016-12-01 19:18:45 -0500
49698
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
49699
+ Processing by StaticController#generic_error as HTML
49700
+ Completed 500 Internal Server Error in 0ms (ActiveRecord: 0.0ms)
49701
+
49702
+ RuntimeError (standard-error):
49703
+ app/controllers/static_controller.rb:7:in `generic_error'
49704
+
49705
+
49706
+ Errdo::Error Load (0.9ms) SELECT "errors".* FROM "errors" WHERE "errors"."backtrace_hash" = ? LIMIT 1 [["backtrace_hash", "trollers/static_controller.rb:7:in `generic_error'standard-errorRuntimeError"]]
49707
+  (0.1ms) begin transaction
49708
+ SQL (0.6ms) INSERT INTO "error_occurrences" ("ip", "user_agent", "query_string", "param_values", "cookie_values", "header_values", "error_id", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) [["ip", "127.0.0.1"], ["user_agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.100 Safari/537.36"], ["query_string", ""], ["param_values", "--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\ncontroller: static\naction: generic_error\n"], ["cookie_values", "---\nremember_user_token: W1sxXSwiJDJhJDEwJC9DbmZGRzNSQVd4VnlsWVNLdFJtVGUiLCIxNDc5NTkyMzk1LjM0MTExNjciXQ==--8a6748f30e89e765bea9d3050937b6ec2e7b7f89\n_ga: GA1.1.2096945490.1464561447\n"], ["header_values", "---\nX-Frame-Options: SAMEORIGIN\nX-XSS-Protection: 1; mode=block\nX-Content-Type-Options: nosniff\n"], ["error_id", 5], ["created_at", "2016-12-02 00:18:45.932184"], ["updated_at", "2016-12-02 00:18:45.932184"]]
49709
+ SQL (0.3ms) UPDATE "errors" SET "occurrence_count" = COALESCE("occurrence_count", 0) + 1 WHERE "errors"."id" = ? [["id", 5]]
49710
+ Errdo::Error Exists (0.5ms) SELECT 1 AS one FROM "errors" WHERE ("errors"."backtrace_hash" = 'trollers/static_controller.rb:7:in `generic_error''standard-errorRuntimeError' AND "errors"."id" != 5) LIMIT 1
49711
+ SQL (0.7ms) UPDATE "errors" SET "occurrence_count" = ?, "last_occurred_at" = ?, "updated_at" = ? WHERE "errors"."id" = ? [["occurrence_count", 69], ["last_occurred_at", "2016-12-02 00:18:45.932184"], ["updated_at", "2016-12-02 00:18:45.962370"], ["id", 5]]
49712
+ Errdo::Error Exists (0.2ms) SELECT 1 AS one FROM "errors" WHERE ("errors"."backtrace_hash" = 'trollers/static_controller.rb:7:in `generic_error''standard-errorRuntimeError' AND "errors"."id" != 5) LIMIT 1
49713
+ SQL (2.3ms) UPDATE "errors" SET "last_experiencer_id" = ?, "last_experiencer_type" = ?, "updated_at" = ? WHERE "errors"."id" = ? [["last_experiencer_id", nil], ["last_experiencer_type", nil], ["updated_at", "2016-12-02 00:18:45.984969"], ["id", 5]]
49714
+  (6.5ms) commit transaction
49715
+ Errdo::ErrorOccurrence Load (0.4ms) SELECT "error_occurrences".* FROM "error_occurrences" ORDER BY "error_occurrences"."id" DESC LIMIT 1
49716
+ Errdo::ErrorOccurrence Load (0.7ms) SELECT "error_occurrences".* FROM "error_occurrences" ORDER BY "error_occurrences"."id" DESC LIMIT 1 OFFSET 1
49717
+ Errdo::ErrorOccurrence Load (4.9ms) SELECT "error_occurrences".* FROM "error_occurrences" ORDER BY created_at DESC LIMIT 1 OFFSET 1
49718
+ Errdo::ErrorOccurrence Load (1.7ms) SELECT "error_occurrences".* FROM "error_occurrences" ORDER BY created_at DESC LIMIT 1 OFFSET 2
49719
+ Errdo::ErrorOccurrence Load (2.3ms) SELECT "error_occurrences".* FROM "error_occurrences" ORDER BY created_at DESC LIMIT 1
49720
+ Errdo::ErrorOccurrence Load (4.1ms) SELECT "error_occurrences".* FROM "error_occurrences" ORDER BY created_at DESC LIMIT 1 OFFSET 100
49721
+ Errdo::ErrorOccurrence Load (1.7ms) SELECT "error_occurrences".* FROM "error_occurrences" ORDER BY created_at DESC LIMIT 1 OFFSET 1
49722
+ Errdo::ErrorOccurrence Load (1.0ms) SELECT "error_occurrences".* FROM "error_occurrences" WHERE "error_occurrences"."error_id" = ? ORDER BY "error_occurrences"."id" DESC LIMIT 1 OFFSET 1 [["error_id", 5]]
49723
+ Errdo::ErrorOccurrence Load (1.0ms) SELECT "error_occurrences".* FROM "error_occurrences" WHERE "error_occurrences"."error_id" = ? ORDER BY created_at DESC LIMIT 1 OFFSET 1 [["error_id", 5]]
49724
+ Errdo::ErrorOccurrence Load (1.7ms) SELECT "error_occurrences".* FROM "error_occurrences" WHERE "error_occurrences"."error_id" = ? ORDER BY created_at DESC LIMIT 1 OFFSET 0 [["error_id", 5]]
49725
+ Errdo::ErrorOccurrence Load (0.5ms) SELECT "error_occurrences".* FROM "error_occurrences" ORDER BY "error_occurrences"."id" DESC LIMIT 1