notable 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39f31b3937daa5a43922f53cef4cbbe047090895
4
- data.tar.gz: 1624b16f9ab8aaf9c37d8532d2ec1403ca0aa6fa
3
+ metadata.gz: cfeaf681c5c6bca189685a9e36dbf30b589537c0
4
+ data.tar.gz: 5961aa16bf2c1b84cd7139b9e58fb2f1ab3ea7db
5
5
  SHA512:
6
- metadata.gz: d040b8cc31f31df4832c462134fc7efa9976bf13326312d8ec4cfe91615a010f04e612c428c756aa1d70a95d36ede5139841e27da0f5d8b01db6a8d3d2d6208c
7
- data.tar.gz: dd04f4f6a83a81524c7c0a53c159a4719b6f7d78ba4855ed052ecb96fa26ded0369f159c351b3870efda977b86938bb9196554e563572d31e183997ba1c0178e
6
+ metadata.gz: 9af63ec903a2c5f00d98db5f44d2a1fc436d12c31f67e27406ac320d635a1afad3c0fc7b028098b34575ca2d6dd48eeb688a2c504909b60656a912cf1aac158a
7
+ data.tar.gz: eba8cf5a860f802c558eae70b45de5d97945573387a6b578225f99df5b4126bbc7e77b25ba6816164c8f6bee3b457196d5ad52b26f574218fe2885bb463bf0d5
data/README.md CHANGED
@@ -1,17 +1,26 @@
1
1
  # Notable
2
2
 
3
- Track notable requests and background jobs
3
+ :star2: Extraordinary insight into your users and background jobs
4
4
 
5
- See users affected by:
5
+ Wouldn’t it be great to see when one of your users encounters an error, timeout, or validation failure? Now you can - directly in your admin pages.
6
+
7
+ #### Introducing Notable
8
+
9
+ Notable tracks notable requests and background jobs and stores them in your database. What makes a request or job notable? There are a number of default situations, but ultimately you decide what interests you.
10
+
11
+ By default, Notable tracks:
6
12
 
7
13
  - errors
8
- - slow requests, jobs, and timeouts
9
14
  - 404s
15
+ - slow requests and jobs
16
+ - timeouts
10
17
  - validation failures
11
18
  - CSRF failures
12
19
  - unpermitted parameters
13
20
  - blocked and throttled requests
14
21
 
22
+ You can track custom notes as well.
23
+
15
24
  :tangerine: Battle-tested at [Instacart](https://www.instacart.com)
16
25
 
17
26
  ## Installation
@@ -37,19 +46,27 @@ For a web interface, check out [Notable Web](https://github.com/ankane/notable_w
37
46
  A `Notable::Request` is created for:
38
47
 
39
48
  - errors
40
- - slow requests and timeouts
41
49
  - 404s
50
+ - slow requests
51
+ - timeouts
42
52
  - validation failures
43
- - CSRF failures
53
+ - [CSRF failures](http://guides.rubyonrails.org/security.html#cross-site-request-forgery-csrf)
44
54
  - unpermitted parameters
45
55
  - blocked and throttled requests
46
56
 
57
+ For timeouts, use [Slowpoke](https://github.com/ankane/slowpoke).
58
+
59
+ For blocked and throttled requests, use [Rack Attack](https://github.com/kickstarter/rack-attack).
60
+
47
61
  ## Jobs
48
62
 
63
+ Wouldn’t it be great to have a record of exact jobs that fail?
64
+
49
65
  A `Notable::Job` is created for:
50
66
 
51
67
  - errors
52
68
  - slow jobs
69
+ - validation failures
53
70
 
54
71
  Currently works with Delayed Job and Sidekiq.
55
72
 
@@ -59,6 +76,12 @@ Currently works with Delayed Job and Sidekiq.
59
76
  Notable.track(note_type, note)
60
77
  ```
61
78
 
79
+ Like
80
+
81
+ ```ruby
82
+ Notable.track("Auth Event", "Signed In")
83
+ ```
84
+
62
85
  ## Customize
63
86
 
64
87
  Disable tracking in certain environments
@@ -1,7 +1,7 @@
1
1
  require "notable/version"
2
2
 
3
3
  require "request_store"
4
- require "robustly"
4
+ require "safely_block"
5
5
  require "action_dispatch/middleware/debug_exceptions"
6
6
 
7
7
  # middleware
@@ -47,6 +47,10 @@ module Notable
47
47
  (RequestStore.store[:notable_notes] ||= []) << {note_type: note_type, note: note}
48
48
  end
49
49
 
50
+ def self.track_error(e)
51
+ track "Error", "#{e.class.name}: #{e.message}"
52
+ end
53
+
50
54
  def self.notes
51
55
  RequestStore.store[:notable_notes].to_a
52
56
  end
@@ -65,6 +69,7 @@ module Notable
65
69
  yield
66
70
  rescue Exception => e
67
71
  exception = e
72
+ track_error(e)
68
73
  ensure
69
74
  notes = Notable.notes
70
75
  Notable.clear_notes
@@ -72,7 +77,6 @@ module Notable
72
77
  runtime = Time.now - start_time
73
78
 
74
79
  safely do
75
- notes << {note_type: "Error", note: "#{exception.class.name}: #{exception.message}"} if exception
76
80
  notes << {note_type: "Slow Job"} if runtime > Notable.slow_job_threshold
77
81
 
78
82
  notes.each do |note|
@@ -1,3 +1,3 @@
1
1
  module Notable
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_dependency "request_store"
22
- spec.add_dependency "robustly"
22
+ spec.add_dependency "safely_block"
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.7"
25
25
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-22 00:00:00.000000000 Z
11
+ date: 2015-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: request_store
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: robustly
28
+ name: safely_block
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -116,8 +116,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  version: '0'
117
117
  requirements: []
118
118
  rubyforge_project:
119
- rubygems_version: 2.2.2
119
+ rubygems_version: 2.4.5
120
120
  signing_key:
121
121
  specification_version: 4
122
122
  summary: Track notable requests and background jobs
123
123
  test_files: []
124
+ has_rdoc: