log_parser_notifier 0.0.7 → 0.0.8

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: 84c5e471688b6f6865d222445b3a89a51d7093a4
4
- data.tar.gz: 069624841b3ee3dd1ae90b56062664f6fc763ee9
3
+ metadata.gz: 1c53c7da371f4a6fd7f062ca48bf0e0c98e1840d
4
+ data.tar.gz: 16090b43f86e33cadfbe5b1752bde2c9b28f1057
5
5
  SHA512:
6
- metadata.gz: 031f31efea968d4ddf83362d3fa0e4cb049953f4ac775893aad483deaa4a0606b3aa7ac5ab0591f79c152509b769d8544abb6df100ae8696e6819366d506e992
7
- data.tar.gz: acb2c9f17dca66b6784d7520381b3e636e41b3e7b2a652e0eb1a373ec42a26e2d679b3a60a98a689a5d687afd3e544c4c510aa43342ef29e3000988653c10b0d
6
+ metadata.gz: eab6a4ce0768bb4069faeb74cf9a36f1509a0153a88f90fdf0966c5deea8f4be4121ab36f1c0ccc9388745390e8f0b8b70f144ce33b9c8e91e24692493c24462
7
+ data.tar.gz: 1f5fc1f06017d1392a57a6a086490b80c59634c8405b13f71627dbd402edc0e3a3684daab7d9a7044ea14bd31749d690116ac360ed145cf63e337b67a55b91a3
@@ -57,7 +57,7 @@ module LogParserNotifier
57
57
  when :rendered
58
58
  " Rendered #{line_hash[:rendered_file]} (#{line_hash[:partial_duration]}ms)"
59
59
  when :completed
60
- "Completed #{line_hash[:status]} OK in #{(line_hash[:duration] * 1000).to_i}ms (Views: #{line_hash[:view] * 1000}ms | ActiveRecord: #{line_hash[:db] * 1000}ms)"
60
+ "Completed #{line_hash[:status]} OK in #{(line_hash[:duration] * 1000).to_i}ms (Views: #{(line_hash[:view] || 0) * 1000}ms | ActiveRecord: #{(line_hash[:db] || 0) * 1000}ms)"
61
61
  else
62
62
  line_hash.inspect
63
63
  end
@@ -1,3 +1,3 @@
1
1
  module LogParserNotifier
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
@@ -35,7 +35,7 @@ module LogParserNotifier
35
35
  expect_any_instance_of(Statsd).to receive('event').with(
36
36
  'DocumentsController#new GET slow request 0.8 sec',
37
37
  "Started GET \"/documents/new?template_id=30000&state=AK\" for 123.193.169.96 at 2015-09-17 03:19:58 +0800\nProcessing by DocumentsController#new as HTML\nParameters: {:template_id=>\"30000\", :state=>\"AK\"}\n Rendered documents/_preview.html.erb (0.0ms)\n Rendered shared/_contact_number.erb (0.0ms)\n Rendered shared/_disclaimer.html.erb (0.001ms)\nCompleted 200 OK in 800ms (Views: 34.0ms | ActiveRecord: 4.0ms)",
38
- date_happened: 1442431198,
38
+ date_happened: '1442431198',
39
39
  aggregation_key: 'slow_request_rails',
40
40
  source_type_name: 'rails_log',
41
41
  alert_type: 'warning',
@@ -45,6 +45,27 @@ module LogParserNotifier
45
45
  end
46
46
  end
47
47
 
48
+ describe 'redirect request' do
49
+ before { @logs = RailsLogRequests.redirect_request }
50
+ after { rails_request_notifier.parse_and_trigger_notifications }
51
+
52
+ it 'should record the number of successful requests' do
53
+ expect_any_instance_of(Statsd).to receive(:increment).with('rails.requests', tags: %w(controller:SessionsController action:create con_act:SessionsController#create))
54
+ end
55
+
56
+ it 'should record the average load time of the requests' do
57
+ expect_any_instance_of(Statsd).to receive(:timing).with('rails.load_time', 90.6, tags: %w(controller:SessionsController action:create con_act:SessionsController#create))
58
+ end
59
+
60
+ it 'should not record the number of failed requests' do
61
+ expect_any_instance_of(Statsd).to_not receive(:increment).with('rails.failed_requests', anything)
62
+ end
63
+
64
+ it 'should not create an event for short requests' do
65
+ expect_any_instance_of(Statsd).to_not receive('event')
66
+ end
67
+ end
68
+
48
69
  describe 'failed request' do
49
70
  before { @logs = RailsLogRequests.failed_request }
50
71
  after { rails_request_notifier.parse_and_trigger_notifications }
@@ -41,6 +41,14 @@ ActiveRecord::RecordNotFound (Couldn't find Document with 'id'=9293 [WHERE "docu
41
41
  )
42
42
  end
43
43
 
44
+ def self.redirect_request
45
+ StringIO.new %Q(Started POST "/users/login" for 208.114.165.166 at 2015-11-17 07:01:05 +0000
46
+ Processing by SessionsController#create as HTML
47
+ Parameters: {"utf8"=>"✓", "authenticity_token"=>"qmtPC6WD3lnffr/j/eFSKjM6LUFtPlOBEt3EJoiWuw0=", "return_to"=>"", "login_type"=>"[FILTERED]", "user"=>{"email"=>"jetbarker@outlook.com", "password"=>"[FILTERED]", "remember_me"=>"0"}, "commit"=>"Login"}
48
+ Redirected to https://app.resumegenius.com/dashboard
49
+ Completed 302 Found in 90.6ms (ActiveRecord: 5.8ms))
50
+ end
51
+
44
52
  def self.partial_request
45
53
  StringIO.new %Q(I, [2015-08-24T07:36:43.598000 #19020] INFO -- : Started GET "/dashboard" for 50.31.29.217 at 2015-08-24 07:36:43 +0000
46
54
  I, [2015-08-24T07:36:43.603000 #19020] INFO -- : Processing by DashboardController#index as HTML
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.7
4
+ version: 0.0.8
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-09-17 00:00:00.000000000 Z
11
+ date: 2015-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: request-log-analyzer