librato-metrics 2.1.0 → 2.1.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.
data.tar.gz.sig CHANGED
Binary file
@@ -1,5 +1,8 @@
1
1
  ## Changelog
2
2
 
3
+ ### Version 2.1.1
4
+ * Fix `#empty?` to check queued payload (#137, Cyril David)
5
+
3
6
  ### Version 2.1.0
4
7
  * Add support for tagged measurements (#121)
5
8
 
data/README.md CHANGED
@@ -5,6 +5,12 @@ Librato Metrics
5
5
 
6
6
  A convenient Ruby wrapper for the Librato Metrics API.
7
7
 
8
+ ---
9
+
10
+ **NOTE:** Starting with version 2.1.0 librato-metrics requires a Librato account that [supports tagged metrics](https://www.librato.com/docs/kb/faq/account_questions/tags_or_sources/). If your Librato account doesn't yet support tagged metrics please use the [1.6.1 version](https://rubygems.org/gems/librato-metrics/versions/1.6.1).
11
+
12
+ ---
13
+
8
14
  This gem provides granular control for scripting interactions with the Metrics core API. It is well suited for integrations, scripts, workers & background jobs. If you want to submit from a web app, take at look at [librato-rails](https://github.com/librato/librato-rails) and/or [librato-rack](https://github.com/librato/librato-rack).
9
15
 
10
16
  ## Installation
@@ -334,4 +340,4 @@ We also maintain a set of [examples of common uses](https://github.com/librato/l
334
340
 
335
341
  ## Copyright
336
342
 
337
- Copyright (c) 2011-2016 [Librato Inc.](http://librato.com) See LICENSE for details.
343
+ Copyright (c) 2011-2017 [Librato Inc.](http://librato.com) See LICENSE for details.
@@ -40,7 +40,7 @@ module Librato
40
40
  #
41
41
  # @return Boolean
42
42
  def submit
43
- return true if self.queued.empty?
43
+ return true if self.empty?
44
44
  options = {per_request: @per_request}
45
45
  if persister.persist(self.client, self.queued, options)
46
46
  @last_submit_time = Time.now
@@ -75,7 +75,7 @@ module Librato
75
75
  #
76
76
  # @return Boolean
77
77
  def empty?
78
- @queued.empty?
78
+ gauges.empty? && counters.empty? && measurements.empty?
79
79
  end
80
80
 
81
81
  # Remove all queued metrics
@@ -1,5 +1,5 @@
1
1
  module Librato
2
2
  module Metrics
3
- VERSION = "2.1.0"
3
+ VERSION = "2.1.1"
4
4
  end
5
5
  end
@@ -301,6 +301,11 @@ module Librato
301
301
  subject.add foo: {type: :gauge, value: 121212}
302
302
  expect(subject.empty?).to be false
303
303
  end
304
+
305
+ it "returns true when nothing merged" do
306
+ subject.merge!(Librato::Metrics::Aggregator.new)
307
+ expect(subject.empty?).to be true
308
+ end
304
309
  end
305
310
 
306
311
  describe "#gauges" do
@@ -313,6 +318,14 @@ module Librato
313
318
  it "returns [] when no queued gauges" do
314
319
  expect(subject.gauges).to be_empty
315
320
  end
321
+
322
+ context "when there are no metrics" do
323
+ it "it does not persist and returns true" do
324
+ subject.merge!(Librato::Metrics::Aggregator.new)
325
+ subject.persister.return_value(false)
326
+ expect(subject.submit).to be true
327
+ end
328
+ end
316
329
  end
317
330
 
318
331
  describe "#last_submit_time" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: librato-metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -36,7 +36,7 @@ cert_chain:
36
36
  alpaTFAzbFM2bDlwNzBQY3BjbCtJY0U0dmVxWm1tS0MKc0dlcGdSY2xDNlVi
37
37
  WmgreVEzYWxYVmdoTTJxc29uQXdJL3JUTm1GSk45a1FuNm5QOStmMVVmL3Fa
38
38
  Rk5jam40TAo5Ymc9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
39
- date: 2017-01-25 00:00:00.000000000 Z
39
+ date: 2017-03-20 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: faraday
metadata.gz.sig CHANGED
Binary file