nexaas-queue_time 0.1.0 → 0.2.0
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 +4 -4
- data/CHANGELOG.md +42 -0
- data/lib/nexaas/queue_time/middleware.rb +9 -1
- data/lib/nexaas/queue_time/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e48475f10c2bf68a6e0486bbf1d0c2c1b66f2e71d56ad35392707807ac158d66
|
|
4
|
+
data.tar.gz: bad0970dfd5d9ee2496fec837a0fb7fb4e2b63ede476820682c80175ef2bbc17
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
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
|
|
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.
|
|
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
|