alacrity-rails 0.2.0 → 0.3.0

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: 453dd5ed4a8173cab3ccca146a1fa7827cc81d2e
4
- data.tar.gz: 6959b45a643e9a7e8814af00710eb61a188abd97
3
+ metadata.gz: d2ebad46ea6fbcdeb0f2ea4b6d9e75b4b1a2bb36
4
+ data.tar.gz: d9bc00ae09670c29a19334acf2621febe1b39a4b
5
5
  SHA512:
6
- metadata.gz: a284cb2d4c66c43244e0689f5499fc81cc96cdda869951b9266dbc1f744d5225f8ad7e1bf3975f272dd87bc3c4b8bb837573fd1d592ba475af769bf299c389e7
7
- data.tar.gz: 9da624496779a56b6dd4b1db105fc97b975fef39368b9e443acdea6a4877d3dff7713c643b9a5ddb4b2d3c166c5462e08056ae594d32885225761ea05718de3e
6
+ metadata.gz: 7e22d676984230594dc2b9c32975923baaba7acfa9b35fc298353005fd7711a9a5f1f93bef8f51155b3afb1bf3a35c80efa8b67d2638dd15c3284d0c4f086dbf
7
+ data.tar.gz: 09e4057d68e49dd70a1506ea1e3667fd2322766e914b980797ebde1074c3820840c395c3e3aa439e816cf2ab59353966db7445aaaefd712ceeb3aa9683fe9dea
@@ -13,9 +13,12 @@ module AlacrityRails
13
13
  transaction&.store_timeline_event(data)
14
14
  end
15
15
 
16
- def self.close_transaction!
17
- this_transaction = transaction
18
- Thread.new { transmit(this_transaction) }
16
+ def self.close_transaction!(response)
17
+ if transaction
18
+ transaction.status = response.first
19
+ this_transaction = transaction
20
+ Thread.new { transmit(this_transaction) }
21
+ end
19
22
  ensure
20
23
  cleanup
21
24
  end
@@ -3,7 +3,7 @@ module AlacrityRails
3
3
  def call(env)
4
4
  Client.open_transaction(env)
5
5
  response = app.call(env)
6
- Client.close_transaction!
6
+ Client.close_transaction!(response)
7
7
  response
8
8
  end
9
9
  end
@@ -4,12 +4,16 @@ module AlacrityRails
4
4
  def self.activate
5
5
  ActiveSupport::Notifications.subscribe 'process_action.action_controller' do |name, started, finished, unique_id, data|
6
6
  AlacrityRails::Client.store_request(
7
- started_at: started,
8
- finished_at: finished,
9
7
  controller: data[:controller],
10
8
  action: data[:action],
11
- format: data[:format],
12
- status: data[:status]
9
+ format: data[:format]
10
+ )
11
+
12
+ AlacrityRails::Client.store_timeline_event(
13
+ event_type: 'framework',
14
+ engine: 'ActionController',
15
+ started_at: started,
16
+ finished_at: finished,
13
17
  )
14
18
  end
15
19
  end
@@ -1,21 +1,18 @@
1
1
  module AlacrityRails::Transaction
2
2
  class WebTransaction < Base
3
3
  attr_accessor :url, :middleware_started_at, :controller, :action, :format,
4
- :method, :status, :framework_started_at, :framework_finished_at
4
+ :method, :status
5
5
 
6
6
  def initialize(env={})
7
7
  self.middleware_started_at = absolute_time(DateTime.now)
8
- self.url = ["#{env['rack.url_scheme']}://", env['HTTP_HOST'], env['REQUEST_PATH']].compact.join
8
+ self.url = env['REQUEST_URI']
9
9
  self.method = env['REQUEST_METHOD']
10
10
  end
11
11
 
12
12
  def store_request(data)
13
- self.framework_started_at = absolute_time(data[:started_at].to_datetime)
14
- self.framework_finished_at = absolute_time(data[:finished_at].to_datetime)
15
13
  self.controller = data[:controller]
16
14
  self.action = data[:action]
17
15
  self.format = data[:format]
18
- self.status = data[:status]
19
16
  end
20
17
 
21
18
  def store_timeline_event(data)
@@ -39,8 +36,6 @@ module AlacrityRails::Transaction
39
36
  middleware_elapsed: middleware_finished_at - middleware_started_at,
40
37
  middleware_started_at: middleware_started_at,
41
38
  middleware_finished_at: middleware_finished_at,
42
- framework_started_at: framework_started_at,
43
- framework_finished_at: framework_finished_at,
44
39
  format: format,
45
40
  method: method,
46
41
  status: status,
@@ -1,3 +1,3 @@
1
1
  module AlacrityRails
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alacrity-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alacrity, LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-10 00:00:00.000000000 Z
11
+ date: 2017-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails