pliny-librato 0.6.0 → 0.6.1
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 +6 -0
- data/lib/pliny/librato/metrics/backend.rb +15 -5
- 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: 071981ac7440cbc14b5460f37cd9fc3323fddf54
|
|
4
|
+
data.tar.gz: b8d68e261e3cbe9cb2c5f82570a97018eaec9007
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bc150f45c85b638a513af396a2f4fbf90de287ffcb5597ea9e4a9ce952f80d2de8ea90d833f1e2dd9c43c0de6d6136029b461666b7aa067e4d894063f049ba07
|
|
7
|
+
data.tar.gz: 6cfa86f846a58a4c4af218ba123b2d4548c3832a49b6c3658dd322a831c44138892af3abef8f7e5808ec477301f8693d52fd189b7137454182ea4fa99bdcfb14
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
## Unreleased
|
|
8
8
|
|
|
9
|
+
## 0.6.1
|
|
10
|
+
|
|
11
|
+
### Fixes
|
|
12
|
+
|
|
13
|
+
- Fixes a thread safety issue introduced in 0.6.0. [#13](https://github.com/heroku/pliny-librato/pull/13)
|
|
14
|
+
|
|
9
15
|
## 0.6.0
|
|
10
16
|
|
|
11
17
|
### Added
|
|
@@ -9,11 +9,15 @@ module Pliny
|
|
|
9
9
|
# from Pliny::Metrics onto a queue that gets submitted in batches.
|
|
10
10
|
class Backend
|
|
11
11
|
def initialize(source: nil, interval: 60)
|
|
12
|
+
@source = source
|
|
12
13
|
@interval = interval
|
|
13
14
|
@mutex = Mutex.new
|
|
14
15
|
@counter_cache = ::Librato::Collector::CounterCache.new(default_tags: nil)
|
|
15
16
|
@aggregator = ::Librato::Metrics::Aggregator.new
|
|
16
|
-
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def new_librato_queue
|
|
20
|
+
::Librato::Metrics::Queue.new(
|
|
17
21
|
source: source,
|
|
18
22
|
skip_measurement_times: true
|
|
19
23
|
)
|
|
@@ -46,7 +50,7 @@ module Pliny
|
|
|
46
50
|
|
|
47
51
|
private
|
|
48
52
|
|
|
49
|
-
attr_reader :interval, :timer, :counter_cache, :aggregator
|
|
53
|
+
attr_reader :source, :interval, :timer, :counter_cache, :aggregator
|
|
50
54
|
|
|
51
55
|
def start_timer
|
|
52
56
|
@timer = Thread.new do
|
|
@@ -58,12 +62,18 @@ module Pliny
|
|
|
58
62
|
end
|
|
59
63
|
|
|
60
64
|
def flush_librato
|
|
65
|
+
queue = new_librato_queue
|
|
66
|
+
|
|
61
67
|
sync do
|
|
62
|
-
counter_cache.
|
|
63
|
-
|
|
68
|
+
# Gather all counters / measures from the aggregator / counter_cache.
|
|
69
|
+
counter_cache.flush_to(queue)
|
|
70
|
+
queue.merge!(aggregator)
|
|
64
71
|
aggregator.clear
|
|
65
72
|
end
|
|
66
|
-
|
|
73
|
+
|
|
74
|
+
# Submit explicitly, given the queue won't pass autosubmit_check
|
|
75
|
+
# (because @autosubmit_count=nil @autosubmit_interval=nil)
|
|
76
|
+
queue.submit
|
|
67
77
|
end
|
|
68
78
|
|
|
69
79
|
def sync(&block)
|
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.6.
|
|
4
|
+
version: 0.6.1
|
|
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-03-
|
|
12
|
+
date: 2017-03-24 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: librato-metrics
|