l2meter 0.0.4 → 0.0.5
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 +4 -4
- data/README.md +11 -0
- data/lib/l2meter/configuration.rb +1 -1
- data/lib/l2meter/emitter.rb +5 -6
- data/lib/l2meter/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9dfbf4e39c16435603394a7404fbac26b60c5142
|
4
|
+
data.tar.gz: 48cdfe785015cf19420daae0c1928b46b85d5f88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2baf257241f5b9975294db76308a3a52bf5a8908656123cbefd39dbba5f7e63ea8f44c9743ea9da9c35c0682d5f04e3fb496ac41120bfac4337e9954a5ca1093
|
7
|
+
data.tar.gz: 1321770da5b2f42aef7c068325c0f9323673caf563487ce991d94df7f89167aa7495c6c5200562e4fcb2d0dceb36b41ce8251f8be5727e6e2fe6872c5d60c461
|
data/README.md
CHANGED
@@ -159,6 +159,17 @@ config.source = "production"
|
|
159
159
|
metrics.log foo: :bar # => source=production foo=bar
|
160
160
|
```
|
161
161
|
|
162
|
+
#### Prefix
|
163
|
+
|
164
|
+
Prefix allows namespacing your measure/count/unique/sample calls.
|
165
|
+
|
166
|
+
```ruby
|
167
|
+
config.prefix = "my-app"
|
168
|
+
|
169
|
+
# ...
|
170
|
+
|
171
|
+
metrics.count :users, 100500 # => count#my-app.users=100500
|
172
|
+
|
162
173
|
## Silence
|
163
174
|
|
164
175
|
There's a way to temporary silence the log emitter. This might be userful for
|
data/lib/l2meter/emitter.rb
CHANGED
@@ -29,13 +29,11 @@ module L2meter
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def measure(metric, value, unit: nil)
|
32
|
-
|
33
|
-
log_with_prefix :measure, metric, value
|
32
|
+
log_with_prefix :measure, metric, value, unit: unit
|
34
33
|
end
|
35
34
|
|
36
35
|
def sample(metric, value, unit: nil)
|
37
|
-
|
38
|
-
log_with_prefix :sample, metric, value
|
36
|
+
log_with_prefix :sample, metric, value, unit: unit
|
39
37
|
end
|
40
38
|
|
41
39
|
def count(metric, value=1)
|
@@ -95,8 +93,9 @@ module L2meter
|
|
95
93
|
configuration.output.print tokens.join(" ") + "\n"
|
96
94
|
end
|
97
95
|
|
98
|
-
def log_with_prefix(
|
99
|
-
|
96
|
+
def log_with_prefix(method, key, value, unit: nil)
|
97
|
+
key = [configuration.prefix, key, unit].compact * ?.
|
98
|
+
log Hash["#{method}##{key}", value]
|
100
99
|
end
|
101
100
|
|
102
101
|
def wrap(params)
|
data/lib/l2meter/version.rb
CHANGED