l2meter 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/lib/l2meter/emitter.rb +3 -5
- data/lib/l2meter/null_object.rb +5 -6
- data/lib/l2meter/thread_safe.rb +1 -16
- data/lib/l2meter/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: e11fd798f796a3a70084ef2989c0f3d233d55d7f
|
4
|
+
data.tar.gz: 57141bec2eaee516c4913432720d653f52c3009a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f0b4f401895a9b09705d488b96451e8f965d862f24f60255a4db401d2ef0f8b87dc45b960815cd3c64878c28cf63fcbdd43c4124e714e0ef39ccd3876417a51
|
7
|
+
data.tar.gz: ff395e97f4c500d9bd3cada7b0e4ed68af6ae1d8f23eb1bacc16c58217b6cabd197d185b6c3950042e2f254344c7f917bcbe0322a2307a9526d3c916cb77e91e
|
data/README.md
CHANGED
@@ -33,7 +33,7 @@ like so:
|
|
33
33
|
Metrics.log :doing_work do # => doing-work at=start
|
34
34
|
do_some_work #
|
35
35
|
Metrics.log :work_done # => work-done
|
36
|
-
end # => doing-work at=finish elapsed=1.
|
36
|
+
end # => doing-work at=finish elapsed=1.2345
|
37
37
|
```
|
38
38
|
|
39
39
|
In case the exception is raised inside the block, l2meter will report is like
|
@@ -43,7 +43,7 @@ so:
|
|
43
43
|
Metrics.log :doing_work do # => doing-work at=start
|
44
44
|
raise ArgumentError, \ #
|
45
45
|
"something is wrong" #
|
46
|
-
end # => doing-work at=exception exception=ArgumentError message="something is wrong" elapsed=1.
|
46
|
+
end # => doing-work at=exception exception=ArgumentError message="something is wrong" elapsed=1.2345
|
47
47
|
```
|
48
48
|
|
49
49
|
## Context
|
@@ -131,9 +131,9 @@ L2meter also allows to append elapsed time to your log messages automatically.
|
|
131
131
|
```ruby
|
132
132
|
Metrics.with_elapsed do
|
133
133
|
do_work_step_1
|
134
|
-
Metrics.log :step_1_done # => step-1-done elapsed=1.
|
134
|
+
Metrics.log :step_1_done # => step-1-done elapsed=1.2345
|
135
135
|
do_work_step_2
|
136
|
-
Metrics.log :step_2_done # => step-2-done elapsed=2.
|
136
|
+
Metrics.log :step_2_done # => step-2-done elapsed=2.3456
|
137
137
|
end
|
138
138
|
```
|
139
139
|
|
data/lib/l2meter/emitter.rb
CHANGED
@@ -71,8 +71,10 @@ module L2meter
|
|
71
71
|
|
72
72
|
def clone
|
73
73
|
cloned_contexts = @contexts.clone
|
74
|
+
cloned_outputs = @outputs.clone
|
74
75
|
self.class.new(configuration: configuration).instance_eval do
|
75
76
|
@contexts = cloned_contexts
|
77
|
+
@outputs = cloned_outputs
|
76
78
|
self
|
77
79
|
end
|
78
80
|
end
|
@@ -217,11 +219,7 @@ module L2meter
|
|
217
219
|
end
|
218
220
|
|
219
221
|
def elapsed_context(since = Time.now)
|
220
|
-
{ elapsed: -> {
|
221
|
-
end
|
222
|
-
|
223
|
-
def elapsed_value(since)
|
224
|
-
format_float(Time.now - since, unit: ?s)
|
222
|
+
{ elapsed: -> { Time.now - since } }
|
225
223
|
end
|
226
224
|
|
227
225
|
def scrub_value(key, value)
|
data/lib/l2meter/null_object.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
module L2meter
|
2
2
|
class NullObject
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
Emitter.instance_methods(false).each do |method_name|
|
4
|
+
define_method method_name do |*, &block|
|
5
|
+
block && block.call
|
6
|
+
end
|
6
7
|
end
|
7
8
|
|
8
|
-
def
|
9
|
-
yield if block_given?
|
10
|
-
end
|
9
|
+
def print(*); end
|
11
10
|
end
|
12
11
|
end
|
data/lib/l2meter/thread_safe.rb
CHANGED
@@ -12,22 +12,7 @@ module L2meter
|
|
12
12
|
@emitter = emitter.freeze
|
13
13
|
end
|
14
14
|
|
15
|
-
def_delegators :receiver,
|
16
|
-
:batch,
|
17
|
-
:configuration,
|
18
|
-
:count,
|
19
|
-
:fire!,
|
20
|
-
:log,
|
21
|
-
:measure,
|
22
|
-
:merge!,
|
23
|
-
:push_context,
|
24
|
-
:sample,
|
25
|
-
:silence,
|
26
|
-
:silence!,
|
27
|
-
:unique,
|
28
|
-
:unsilence!,
|
29
|
-
:with_elapsed,
|
30
|
-
:with_output
|
15
|
+
def_delegators :receiver, *Emitter.instance_methods(false)
|
31
16
|
|
32
17
|
def context(*args, &block)
|
33
18
|
value = current_emitter.context(*args, &block)
|
data/lib/l2meter/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: l2meter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Pravosud
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|