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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d432f6b4a5b01f98e0ead542ae5e43c15823852d
4
- data.tar.gz: d73cfb2d9a49fe63e6c71baa56385419a51d9464
3
+ metadata.gz: 071981ac7440cbc14b5460f37cd9fc3323fddf54
4
+ data.tar.gz: b8d68e261e3cbe9cb2c5f82570a97018eaec9007
5
5
  SHA512:
6
- metadata.gz: fafc04571c053f2eb05cbfe0baba3e38ef698ecc6eacf0c516c6f7ec4d2adfc483e3243e1a76e55c7d147078fe6296cf50c0310c6c1daff18f1e7e4cc3cf6ebb
7
- data.tar.gz: da313c6aa6c543af1921714b3c54839f12125741caabbb57b6826eb4e6a7e54a58c447615801d3e5071c01431beb6dbede6b8f5ab91d995122af35b3b31715e3
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
- @librato_queue = ::Librato::Metrics::Queue.new(
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, :librato_queue
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.flush_to(librato_queue)
63
- librato_queue.merge!(aggregator)
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
- librato_queue.submit
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)
@@ -1,5 +1,5 @@
1
1
  module Pliny
2
2
  module Librato
3
- VERSION = '0.6.0'.freeze
3
+ VERSION = '0.6.1'.freeze
4
4
  end
5
5
  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.6.0
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-21 00:00:00.000000000 Z
12
+ date: 2017-03-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: librato-metrics