pliny-librato 0.5.1 → 0.5.2
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 +10 -0
- data/README.md +4 -2
- data/lib/pliny/librato/metrics/backend.rb +11 -21
- data/lib/pliny/librato/version.rb +1 -1
- 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: f64355e55742cd9a4eade6f2620a6fb64ad2e0eb
|
|
4
|
+
data.tar.gz: b1bb8a0c6a7809bb88c62750f108553c87548056
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d9f1e300b6f5defdd99af9b4ba57ad5a1773543d18f018ca639b68533efe68cec2e2d0d2d78f2e7a70c8e3a5ea184e6a4fb6ce2128e687b1cac727c41536674f
|
|
7
|
+
data.tar.gz: aa4c903d27c9da3ee019096e1a5f0c65114babf6785835164bc1413b9d9a47ab5ccf1e5bc9b7e8f1913039f48629af6080404fb20e5c40c755f577a1f1a3e728
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
## Unreleased
|
|
8
8
|
|
|
9
|
+
## 0.5.2
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Removed potential deadlock when stopping the backend.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- `Backend#stop` can no longer be called from within a `Signal.trap` block.
|
|
18
|
+
|
|
9
19
|
## 0.5.1
|
|
10
20
|
|
|
11
21
|
### Changed
|
data/README.md
CHANGED
|
@@ -47,12 +47,14 @@ By default, it will send queued metrics every minute, and anytime the
|
|
|
47
47
|
queue reaches 500 metrics. These settings can be configured on initialization.
|
|
48
48
|
|
|
49
49
|
## Shutdown
|
|
50
|
-
By default, any unsubmitted metrics on the queue will not be sent at shutdown.
|
|
50
|
+
By default, any unsubmitted metrics on the queue will not be sent at shutdown.
|
|
51
51
|
It is the responsibility of the caller to trigger this.
|
|
52
52
|
|
|
53
|
+
**Note**: `#stop` will not work with signal traps, as mutexes can't be obtained within traps.
|
|
54
|
+
|
|
53
55
|
```ruby
|
|
54
56
|
# In the main process
|
|
55
|
-
Kernel.
|
|
57
|
+
Kernel.at_exit do
|
|
56
58
|
librato_backend.stop
|
|
57
59
|
end
|
|
58
60
|
|
|
@@ -10,9 +10,13 @@ module Pliny
|
|
|
10
10
|
POISON_PILL = :'❨╯°□°❩╯︵┻━┻'
|
|
11
11
|
|
|
12
12
|
def initialize(source: nil, interval: 60, count: 500)
|
|
13
|
-
@
|
|
14
|
-
@
|
|
15
|
-
@
|
|
13
|
+
@interval = interval
|
|
14
|
+
@mutex = Mutex.new
|
|
15
|
+
@metrics_queue = Queue.new
|
|
16
|
+
@librato_queue = ::Librato::Metrics::Queue.new(
|
|
17
|
+
source: source,
|
|
18
|
+
autosubmit_count: count
|
|
19
|
+
)
|
|
16
20
|
end
|
|
17
21
|
|
|
18
22
|
def report_counts(counts)
|
|
@@ -31,14 +35,15 @@ module Pliny
|
|
|
31
35
|
|
|
32
36
|
def stop
|
|
33
37
|
metrics_queue.push(POISON_PILL)
|
|
34
|
-
timer
|
|
38
|
+
# Ensure timer is not running when we terminate it
|
|
39
|
+
sync { timer.terminate }
|
|
35
40
|
counter.join
|
|
36
41
|
flush_librato
|
|
37
42
|
end
|
|
38
43
|
|
|
39
44
|
private
|
|
40
45
|
|
|
41
|
-
attr_reader :
|
|
46
|
+
attr_reader :interval, :timer, :counter, :metrics_queue, :librato_queue
|
|
42
47
|
|
|
43
48
|
def start_timer
|
|
44
49
|
@timer = Thread.new do
|
|
@@ -67,25 +72,10 @@ module Pliny
|
|
|
67
72
|
end
|
|
68
73
|
|
|
69
74
|
def sync(&block)
|
|
70
|
-
mutex.synchronize(&block)
|
|
75
|
+
@mutex.synchronize(&block)
|
|
71
76
|
rescue => error
|
|
72
77
|
Pliny::ErrorReporters.notify(error)
|
|
73
78
|
end
|
|
74
|
-
|
|
75
|
-
def mutex
|
|
76
|
-
@mutex ||= Mutex.new
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def metrics_queue
|
|
80
|
-
@metrics_queue ||= Queue.new
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
def librato_queue
|
|
84
|
-
@librato_queue ||= ::Librato::Metrics::Queue.new(
|
|
85
|
-
source: source,
|
|
86
|
-
autosubmit_count: count
|
|
87
|
-
)
|
|
88
|
-
end
|
|
89
79
|
end
|
|
90
80
|
end
|
|
91
81
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pliny-librato
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Appleton
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2017-01-
|
|
12
|
+
date: 2017-01-13 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: librato-metrics
|