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 +4 -4
- data/lib/meter/backend.rb +1 -1
- data/lib/meter/configuration.rb +10 -0
- data/lib/meter/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: 9c3ca18e1a5edff90911f551faed20d4c682111d
|
4
|
+
data.tar.gz: deefb21a1dc542f56567b90391b3586a19c91bcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/meter/configuration.rb
CHANGED
@@ -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
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.
|
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:
|
11
|
+
date: 2015-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|