logjam_agent 0.9.6 → 0.9.7

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: 9cfa8b992d101abc573fa95d3efb28cdefe8d66e
4
- data.tar.gz: 6746b125ed91579f0619409e96ee0184e1c79022
3
+ metadata.gz: fb53d525dcf6b2c781a75ac0518fde4df23a17aa
4
+ data.tar.gz: 58e74b68432d9be6670ae0aee104c6426476ae3b
5
5
  SHA512:
6
- metadata.gz: ae23146aea9c14e6e3d928c910d78f55058128efb5dcbae8a0a72c676f17037932c5d63a9246c59ba0a79a0a2838227c1abb60c186c77c18837961b28f208f59
7
- data.tar.gz: 6e5a3f6a09f1da1c9b0184bdbc285316f992205d03064acf24e0573f1fff24ec7d57fa3334e91ac5cb91fa634027f8864525837c7c2ba9f81d94315b67860422
6
+ metadata.gz: e6c892318c145e0ee870fcbe34a01767cb5bcf3107001670bf10c87b747cc171d21a4023b66a6e6d8d3210debf783e5b87384f3a18adcf1f76fa2f45b8044a05
7
+ data.tar.gz: f1a17d91b75b4c2a6a8fdd6d90ca1161f00fcc26d8023070ab92f145740b7f8f7096164620280cc4a8cb17af3175e7833fb380edce2fc3e197c55b51089ab0be
@@ -26,11 +26,20 @@ module LogjamAgent
26
26
 
27
27
  def call_app(request, env)
28
28
  start_time = Time.now
29
+ start_time_header = env['HTTP_X_STARTTIME'] # || "t=#{((Time.now - 50.0/1_000.0).to_f*1_000_000).to_i}"
30
+ if start_time_header && start_time_header =~ /\At=(\d+)\z/
31
+ # accuracy?
32
+ http_start_time = Time.at($1.to_f / 1_000_000.0)
33
+ wait_time_ms = (start_time - http_start_time) * 1000
34
+ start_time = http_start_time
35
+ else
36
+ wait_time_ms = 0.0
37
+ end
29
38
  before_dispatch(request, env, start_time)
30
39
  result = @app.call(env)
31
40
  ensure
32
- run_time = Time.now - start_time
33
- after_dispatch(env, result, run_time*1000)
41
+ run_time_ms = (Time.now - start_time) * 1000
42
+ after_dispatch(env, result, run_time_ms, wait_time_ms)
34
43
  end
35
44
 
36
45
  def compute_tags(request)
@@ -71,12 +80,14 @@ module LogjamAgent
71
80
  info "Started #{request.request_method} \"#{path}\" for #{ip} at #{start_time.to_default_s}" unless logjam_request.ignored?
72
81
  end
73
82
 
74
- def after_dispatch(env, result, run_time_ms)
83
+ def after_dispatch(env, result, run_time_ms, wait_time_ms)
75
84
  status = result ? result.first.to_i : 500
76
85
  if completed_info = Thread.current.thread_variable_get(:time_bandits_completed_info)
77
86
  _, additions, view_time, _ = completed_info
78
87
  end
79
- request_info = {:total_time => run_time_ms, :code => status, :view_time => view_time || 0.0}
88
+ request_info = {
89
+ :total_time => run_time_ms, :code => status, :view_time => view_time || 0.0, :wait_time => wait_time_ms
90
+ }
80
91
  logjam_request = LogjamAgent.request
81
92
 
82
93
  if (allowed_time_ms = env['HTTP_X_LOGJAM_CALLER_TIMEOUT'].to_i) > 0 && (run_time_ms > allowed_time_ms)
@@ -1,3 +1,3 @@
1
1
  module LogjamAgent
2
- VERSION = "0.9.6"
2
+ VERSION = "0.9.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logjam_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Kaes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-08 00:00:00.000000000 Z
11
+ date: 2014-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
108
  version: '0'
109
109
  requirements: []
110
110
  rubyforge_project: logjam_agent
111
- rubygems_version: 2.2.0
111
+ rubygems_version: 2.2.2
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: Logjam client library to be used with logjam