formatted-metrics 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a34c6fd59ded3203162150ac1f63aa982c750da9
4
- data.tar.gz: 68cb58c7cf99c4d777e38ea70916442ab74205f5
3
+ metadata.gz: 0c3d04bf2c7178e37e3289af6ddcdeb0962b54d6
4
+ data.tar.gz: 53c8792c4c4ba882b9a6e1293ccbad8285542504
5
5
  SHA512:
6
- metadata.gz: f162ebda0be8a2939a314530fe828c279a18941a7d7a2cbb3db660f13e00406d6e511143bba9574e58b9b602a5fe4760ce552ff8108a25dbc47fdd900d30a567
7
- data.tar.gz: 4c8114e6f9b1ca5c2dc3491b871f2148c58ba2546cdb554352db94495fa093c04e20d24f9ef173e48fa7c88f075b1dfe3557b523ae1682044fd7562856e77676
6
+ metadata.gz: 56b3c01345d6928e6c3d1192c2ad54de27cb77e8efa15f2bb0d6fa1e7ccdf49cbd98509fb61c074518287916c70defc920997d997f6a1a8d8617211f81ba7010
7
+ data.tar.gz: ef0bab7a3c46565b26c6726bfff7ac06dfff6dd9e553aaa46664cf31b5579f41075eeb01494fb49933d252c92a6229e0d61818dfd42261784c01d79302af3c6b
@@ -21,7 +21,8 @@ module Metrics
21
21
  end
22
22
 
23
23
  def source
24
- @source ||= ENV['METRICS_SOURCE'] || ENV['APP_NAME'] || `hostname`.chomp
24
+ return @source if defined? @source
25
+ @source = ENV['METRICS_SOURCE'] || ENV['APP_NAME'] || `hostname`.chomp
25
26
  end
26
27
 
27
28
  def formatter
@@ -22,11 +22,7 @@ module Metrics::Formatters
22
22
  end
23
23
 
24
24
  def full_source(source=nil)
25
- if source
26
- [configuration.source, source].join('.')
27
- else
28
- configuration.source
29
- end
25
+ [configuration.source, source].reject { |s| blank?(s) }.join('.')
30
26
  end
31
27
 
32
28
  def measurement(instrumenter)
@@ -34,5 +30,9 @@ module Metrics::Formatters
34
30
  value = value.round(PRECISION) if value.is_a?(Float)
35
31
  "#{instrumenter.type}##{instrumenter.metric}=#{value}#{instrumenter.units}"
36
32
  end
33
+
34
+ def blank?(string)
35
+ string.nil? || string.empty?
36
+ end
37
37
  end
38
38
  end
@@ -1,3 +1,3 @@
1
1
  module FormattedMetrics
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formatted-metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric J. Holmes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-12 00:00:00.000000000 Z
11
+ date: 2013-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler