log_parser_notifier 0.0.8 → 0.0.9

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: 1c53c7da371f4a6fd7f062ca48bf0e0c98e1840d
4
- data.tar.gz: 16090b43f86e33cadfbe5b1752bde2c9b28f1057
3
+ metadata.gz: 36101de3a98440c4c74be32a2951adbca54a43db
4
+ data.tar.gz: 276b3bab5bc44d9b98a753c9d7331c4b7a744283
5
5
  SHA512:
6
- metadata.gz: eab6a4ce0768bb4069faeb74cf9a36f1509a0153a88f90fdf0966c5deea8f4be4121ab36f1c0ccc9388745390e8f0b8b70f144ce33b9c8e91e24692493c24462
7
- data.tar.gz: 1f5fc1f06017d1392a57a6a086490b80c59634c8405b13f71627dbd402edc0e3a3684daab7d9a7044ea14bd31749d690116ac360ed145cf63e337b67a55b91a3
6
+ metadata.gz: fced35f02dbc4537717e824bc3a0f9e1748f11134c9552da5e2eded9d1bb7d73f84557bca66a9fb36f53eccd1eb31f66789cb41ae4d80752a432472d052fc9e0
7
+ data.tar.gz: a697b16fe1364cfd5e3118141884d7e44f2316d241f71ca98821158a51f4a05cff091e63c2d2bc6f9f1815e9b30ce101e1fc6850fdf860a2b0fce518b8743636
@@ -22,7 +22,10 @@ module LogParserNotifier
22
22
  tags = %W(controller:#{request[:controller]} action:#{request[:action]} con_act:#{request[:controller]}##{request[:action]})
23
23
 
24
24
  LogParserNotifier.logger.debug("processing request for #{request[:controller]}##{request[:action]} with status: #{request[:status]} it is complete: #{request.completed?}")
25
- if request.completed? && request[:status] >= 200 && request[:status] < 400
25
+ if request.completed? &&
26
+ !request[:status].nil? &&
27
+ request[:status] >= 200 &&
28
+ request[:status] < 400
26
29
  statsd.increment 'rails.requests', tags: tags
27
30
  statsd.timing 'rails.load_time', request[:duration] * 1000, tags: tags
28
31
 
@@ -1,3 +1,3 @@
1
1
  module LogParserNotifier
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.9'
3
3
  end
@@ -45,6 +45,20 @@ module LogParserNotifier
45
45
  end
46
46
  end
47
47
 
48
+ describe 'grape failed requests' do
49
+ before { @logs = RailsLogRequests.grape_error_request }
50
+ subject { rails_request_notifier.parse_and_trigger_notifications }
51
+
52
+ it 'should correctly parse the grape request' do
53
+ expect { subject }.to_not raise_error(NoMethodError)
54
+ end
55
+
56
+ it 'should record the number of failed requests' do
57
+ expect_any_instance_of(Statsd).to receive(:increment).with('rails.failed_requests', tags: %w(controller: action: con_act:#))
58
+ subject
59
+ end
60
+ end
61
+
48
62
  describe 'redirect request' do
49
63
  before { @logs = RailsLogRequests.redirect_request }
50
64
  after { rails_request_notifier.parse_and_trigger_notifications }
@@ -30,6 +30,14 @@ I, [2015-08-24T07:36:43.695000 #19020] INFO -- : Completed 200 OK in 800ms (Vie
30
30
  )
31
31
  end
32
32
 
33
+ def self.grape_error_request
34
+ StringIO.new %Q(Started GET "/api/v1/resumes/7297793" for 99.8.124.171 at 2015-11-19 08:04:34 +0000
35
+
36
+ ActiveRecord::RecordNotFound (Couldn't find Resume with id=7297793 [WHERE `resumes`.`user_id` = 18217112]):
37
+ app/api/resumes_api.rb:75:in `block (2 levels) in <class:ResumesApi>'
38
+ )
39
+ end
40
+
33
41
  def self.failed_request
34
42
  StringIO.new %Q(I, [2015-08-24T07:35:11.541000 #19020] INFO -- : Started GET "/documents/9293/preview/?page=0" for 50.31.29.217 at 2015-08-24 07:35:11 +0000
35
43
  I, [2015-08-24T07:35:11.549000 #19020] INFO -- : Processing by DocumentsController#preview as JSON
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: log_parser_notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Moore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-17 00:00:00.000000000 Z
11
+ date: 2015-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: request-log-analyzer