overall_request_times 0.5.0 → 1.0.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/README.md +2 -1
- data/lib/overall_request_times/registry.rb +7 -0
- data/lib/overall_request_times/timer.rb +8 -0
- data/lib/overall_request_times/version.rb +1 -1
- data/lib/overall_request_times.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f58db41c069691725293eddd56fa4b0dc5305e1a
|
4
|
+
data.tar.gz: 02813a0d13297f01e0863bd16c2543407171f192
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d244ef863bfc6a7324952f1f5ba17d8a5be55d18ad70f7354e44cd06bf9726dbba77b2dd1cfade604e250db2bc07a718b12a2d983c848b051a595adb2f828324
|
7
|
+
data.tar.gz: 0665a15ea6ea43e129073cb03cf5eef3114ef0bb41f7bdfe3ceae7efc0fe91d5fab6e24a92b7fc2e30160d67958a053b54f512c95cd6f24f7fe146f6f64b5a10
|
data/README.md
CHANGED
@@ -57,7 +57,8 @@ OverallRequestTimes.stop(:remote_service_name)
|
|
57
57
|
Then to extract the totals to log:
|
58
58
|
|
59
59
|
```ruby
|
60
|
-
OverallRequestTimes.total_for(:remote_service_name)
|
60
|
+
OverallRequestTimes.total_for(:remote_service_name) # => 12.5
|
61
|
+
OverallRequestTimes.call_count_for(:remote_service_name) # => 3
|
61
62
|
```
|
62
63
|
|
63
64
|
And reset the totals at the start of your request cycle:
|
@@ -31,6 +31,13 @@ module OverallRequestTimes
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
def call_count_for(remote_app_name)
|
35
|
+
@mutex.synchronize do
|
36
|
+
timer = @registry[remote_app_name]
|
37
|
+
timer ? timer.call_count : 0
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
34
41
|
def totals
|
35
42
|
@mutex.synchronize do
|
36
43
|
@registry.each_with_object({}) do |(remote_app_name, timer), acc|
|
@@ -16,14 +16,22 @@ module OverallRequestTimes
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
def call_count
|
20
|
+
@timer_mutex.synchronize do
|
21
|
+
@counter
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
19
25
|
def reset!
|
20
26
|
@timer_mutex.synchronize do
|
21
27
|
@total = 0
|
28
|
+
@counter = 0
|
22
29
|
end
|
23
30
|
end
|
24
31
|
|
25
32
|
def add(some_time)
|
26
33
|
@timer_mutex.synchronize do
|
34
|
+
@counter += 1
|
27
35
|
@total += some_time
|
28
36
|
end
|
29
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: overall_request_times
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Donald Plummer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|