meter 0.1.3 → 0.1.4

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: ce4fd155c15a829e11744172377cc5c0e2954b98
4
- data.tar.gz: 76edcf155301fc3917f93057a092792f2efcdd95
3
+ metadata.gz: 9c3ca18e1a5edff90911f551faed20d4c682111d
4
+ data.tar.gz: deefb21a1dc542f56567b90391b3586a19c91bcc
5
5
  SHA512:
6
- metadata.gz: 8e9e802277bb3004d343baf626bbd509336bfccc803906dc890d204e2d1b68bbd6b6a48db30db4c2b1efa1d1ff0d463397659736be68e7e4f673583aafd54a7c
7
- data.tar.gz: 85205b7c512d4713e85d98b329107532a9c772b27597f50e6536f9f156e65413f44d2b4162269e8addc16fc79ef45132f9d6a1934d69c86f7e3c9bbb88eb52da
6
+ metadata.gz: d26ca5e9ce1f4642ad6442ecba7521cf88d9d33308d80b720403c5ebce28c4b3ff92e401f30891a79e2105d0396674004d5657fbaec7e1863a7c2ea5d603fe38
7
+ data.tar.gz: 4254c1b2e5786ae8e47255c6a0cb59b485689c46bc54126132e763e53f73c543949d410035f145548563e9a11c8113b0888708083e87216996f42dc72356812d
data/lib/meter/backend.rb CHANGED
@@ -26,7 +26,7 @@ module Meter
26
26
 
27
27
  def log(stat, data = {})
28
28
  data = { environment: ::Meter.config.environment, Timestamp: Time.now.strftime("%FT%H:%M:%S%:z") }.merge data
29
- data.merge! app: ::Meter.config.namespace, statname: stat
29
+ data.merge! app: ::Meter.config.namespace, host: ::Meter.config.hostname, statname: stat
30
30
  ::Meter.config.logger.debug { "Logging #{log_file} - #{data}"}
31
31
  log_file.open('a') { |f| f.puts(JSON.dump data) }
32
32
  end
@@ -34,6 +34,11 @@ module Meter
34
34
  @log_dir = Pathname.new new_dir
35
35
  end
36
36
 
37
+ def hostname
38
+ @hostname ||= options[:hostname] || default_hostname
39
+ end
40
+ attr_writer :hostname
41
+
37
42
  private
38
43
 
39
44
  def default_logger
@@ -59,5 +64,10 @@ module Meter
59
64
  Pathname.new '/dev/null'
60
65
  end
61
66
 
67
+ def default_hostname
68
+ return File.read('/etc/me').strip if File.readable?('/etc/me')
69
+ return File.read('/etc/hostname').strip if File.readable?('/etc/hostname')
70
+ `hostname -f`.strip
71
+ end
62
72
  end
63
73
  end
data/lib/meter/version.rb CHANGED
@@ -2,7 +2,7 @@ module Meter
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 3
5
+ TINY = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - bukowskis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-10 00:00:00.000000000 Z
11
+ date: 2015-01-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec