nexaas-queue_time 0.1.0 → 0.2.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
  SHA256:
3
- metadata.gz: 1fce5de3abaecb204ca706653c76fa9daa5ba1a9c35c00c25a307921a955cd03
4
- data.tar.gz: e5be90df9edfe1149a538606bf9d48ac08deaf35337ce59e6e57640a637a72f8
3
+ metadata.gz: e48475f10c2bf68a6e0486bbf1d0c2c1b66f2e71d56ad35392707807ac158d66
4
+ data.tar.gz: bad0970dfd5d9ee2496fec837a0fb7fb4e2b63ede476820682c80175ef2bbc17
5
5
  SHA512:
6
- metadata.gz: 8117366d5333d1f8f82e71861276aa7519d4b2f7d8c198bfd6a96e95843eb977b40c4cd37f80b14bd76da4e40126d7985cfcf7a1f6ad456a98f7f97004065ce5
7
- data.tar.gz: d11beac8dc0a3ceaac27ea12e8bc8185380e79f8ef17cef69e7d252ff1c1d302e64f5d44f64ecabfa87ed367658a49d80d41fb57ebee18b1f059c0250c52acd7
6
+ metadata.gz: 20cba9c3530a8e066ee0261486c69a486565dc6a1c86314bf3db4798662d1203bdde51625a4319e4cbe277a301342a6771ad32d3f7c04978d5cb6cdb040da787
7
+ data.tar.gz: f7cf37772229044a1f72b0cd4dc1109e4fbd8a14469d2c25bfc48f0a6cbb927aa691b7908e2be2442a87057069da8602663b033431a619779b1f2c6536da3126
data/CHANGELOG.md ADDED
@@ -0,0 +1,42 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [0.2.0] - 2019-06-28
6
+
7
+ ### Fixed
8
+
9
+ - Extract timestamp from the header
10
+
11
+ ## [0.1.0] - 2019-06-28
12
+
13
+ ### Added
14
+
15
+ - Initial implementation of the gem
16
+
17
+
18
+ [6.0.0]: https://github.com/kickstarter/rack-attack/compare/v5.4.2...v6.0.0/
19
+ [5.4.2]: https://github.com/kickstarter/rack-attack/compare/v5.4.1...v5.4.2/
20
+ [5.4.1]: https://github.com/kickstarter/rack-attack/compare/v5.4.0...v5.4.1/
21
+ [5.4.0]: https://github.com/kickstarter/rack-attack/compare/v5.3.2...v5.4.0/
22
+ [5.3.2]: https://github.com/kickstarter/rack-attack/compare/v5.3.1...v5.3.2/
23
+ [5.3.1]: https://github.com/kickstarter/rack-attack/compare/v5.3.0...v5.3.1/
24
+ [5.3.0]: https://github.com/kickstarter/rack-attack/compare/v5.2.0...v5.3.0/
25
+ [5.2.0]: https://github.com/kickstarter/rack-attack/compare/v5.1.0...v5.2.0/
26
+ [5.1.0]: https://github.com/kickstarter/rack-attack/compare/v5.0.1...v5.1.0/
27
+ [5.0.1]: https://github.com/kickstarter/rack-attack/compare/v5.0.0...v5.0.1/
28
+ [5.0.0]: https://github.com/kickstarter/rack-attack/compare/v4.4.1...v5.0.0/
29
+ [4.4.1]: https://github.com/kickstarter/rack-attack/compare/v4.4.0...v4.4.1/
30
+ [4.4.0]: https://github.com/kickstarter/rack-attack/compare/v4.3.1...v4.4.0/
31
+ [4.3.1]: https://github.com/kickstarter/rack-attack/compare/v4.3.0...v4.3.1/
32
+ [4.3.0]: https://github.com/kickstarter/rack-attack/compare/v4.2.0...v4.3.0/
33
+ [4.2.0]: https://github.com/kickstarter/rack-attack/compare/v4.1.1...v4.2.0/
34
+ [4.1.1]: https://github.com/kickstarter/rack-attack/compare/v4.1.0...v4.1.1/
35
+ [4.1.0]: https://github.com/kickstarter/rack-attack/compare/v4.0.1...v4.1.0/
36
+ [4.0.1]: https://github.com/kickstarter/rack-attack/compare/v4.0.0...v4.0.1/
37
+ [4.0.0]: https://github.com/kickstarter/rack-attack/compare/v3.0.0...v4.0.0/
38
+ [3.0.0]: https://github.com/kickstarter/rack-attack/compare/v2.3.0...v3.0.0/
39
+ [2.3.0]: https://github.com/kickstarter/rack-attack/compare/v2.2.1...v2.3.0/
40
+ [2.2.1]: https://github.com/kickstarter/rack-attack/compare/v2.2.0...v2.2.1/
41
+ [2.2.0]: https://github.com/kickstarter/rack-attack/compare/v2.1.1...v2.2.0/
42
+
@@ -8,7 +8,8 @@ module Nexaas
8
8
  METRIC_NAME = 'request.queue_time'
9
9
 
10
10
  def initialize(app)
11
- @app = app end
11
+ @app = app
12
+ end
12
13
 
13
14
  def call(env)
14
15
  left_queue = Time.now.to_f
@@ -24,9 +25,16 @@ module Nexaas
24
25
  entered_queue = env['HTTP_X_REQUEST_START']
25
26
  return nil if entered_queue.nil?
26
27
 
28
+ entered_queue = extract_timestamp(entered_queue)
27
29
  (left_queue - entered_queue.to_f) * 1000
28
30
  end
29
31
 
32
+ # The header actually comes as `t=1234567890`,
33
+ # so we need to extract the timestamp.
34
+ def extract_timestamp(entered_queue)
35
+ entered_queue.delete('t=')
36
+ end
37
+
30
38
  def send_metric(metric)
31
39
  return unless metric
32
40
 
@@ -1,5 +1,5 @@
1
1
  module Nexaas
2
2
  module QueueTime
3
- VERSION = "0.1.0"
3
+ VERSION = '0.2.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexaas-queue_time
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Mansur
@@ -104,6 +104,7 @@ files:
104
104
  - ".gitignore"
105
105
  - ".rspec"
106
106
  - ".travis.yml"
107
+ - CHANGELOG.md
107
108
  - Gemfile
108
109
  - LICENSE.txt
109
110
  - README.md