traces 0.11.0 → 0.11.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/traces/backend/capture.rb +3 -5
- data/lib/traces/backend/console.rb +4 -5
- data/lib/traces/backend/test.rb +4 -5
- data/lib/traces/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b14640339110cfee8aecc8766c250d7e3cc2a33be144080ed8b478287c0abc39
|
4
|
+
data.tar.gz: 34a6ec9d893ca1c278e4ec38127b15c2dc89b79ac11e1953bfb6cdfeeb8b6a27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 923a1c1e3a387aa487437cafbc2514d9db78f0afaee36cd50d3c06a21daf3ed4395d325c4fdf52ebda422dac3b1fe5e06fbdc2c1b078b58a4246719843ec812c
|
7
|
+
data.tar.gz: '09fd133d87ef78a7ecbe91bc8deaf8be3d1b6d211bb3eafbb5b6b20fa19834ead759290b288368e481aa587301374ae822faa6e82f894403df80d469a69c14ee'
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -17,16 +17,14 @@ module Traces
|
|
17
17
|
module Capture
|
18
18
|
# A span which validates tag assignment.
|
19
19
|
class Span
|
20
|
-
def initialize(context,
|
20
|
+
def initialize(context, name, resource, attributes)
|
21
21
|
@context = context
|
22
|
-
@instance = instance
|
23
22
|
@name = name
|
24
23
|
@resource = resource
|
25
24
|
@attributes = attributes
|
26
25
|
end
|
27
26
|
|
28
27
|
attr :context
|
29
|
-
attr :instance
|
30
28
|
attr :name
|
31
29
|
attr :resource
|
32
30
|
attr :attributes
|
@@ -60,11 +58,11 @@ module Traces
|
|
60
58
|
# Trace the given block of code and log the execution.
|
61
59
|
# @parameter name [String] A useful name/annotation for the recorded span.
|
62
60
|
# @parameter attributes [Hash] Metadata for the recorded span.
|
63
|
-
def trace(name, resource:
|
61
|
+
def trace(name, resource: nil, attributes: {}, &block)
|
64
62
|
context = Context.nested(Fiber.current.traces_backend_context)
|
65
63
|
Fiber.current.traces_backend_context = context
|
66
64
|
|
67
|
-
span = Span.new(context,
|
65
|
+
span = Span.new(context, name, resource, attributes)
|
68
66
|
Capture.spans << span
|
69
67
|
|
70
68
|
yield span
|
@@ -18,9 +18,8 @@ module Traces
|
|
18
18
|
module Console
|
19
19
|
# A span which validates tag assignment.
|
20
20
|
class Span
|
21
|
-
def initialize(context,
|
21
|
+
def initialize(context, name)
|
22
22
|
@context = context
|
23
|
-
@instance = instance
|
24
23
|
@name = name
|
25
24
|
end
|
26
25
|
|
@@ -38,16 +37,16 @@ module Traces
|
|
38
37
|
# Trace the given block of code and log the execution.
|
39
38
|
# @parameter name [String] A useful name/annotation for the recorded span.
|
40
39
|
# @parameter attributes [Hash] Metadata for the recorded span.
|
41
|
-
def trace(name, resource:
|
40
|
+
def trace(name, resource: nil, attributes: {}, &block)
|
42
41
|
context = Context.nested(Fiber.current.traces_backend_context)
|
43
42
|
Fiber.current.traces_backend_context = context
|
44
43
|
|
45
|
-
::Console.logger.info(resource, name, attributes)
|
44
|
+
::Console.logger.info(resource || self, name, attributes)
|
46
45
|
|
47
46
|
if block.arity.zero?
|
48
47
|
yield
|
49
48
|
else
|
50
|
-
yield Span.new(context,
|
49
|
+
yield Span.new(context, name)
|
51
50
|
end
|
52
51
|
end
|
53
52
|
|
data/lib/traces/backend/test.rb
CHANGED
@@ -41,8 +41,9 @@ module Traces
|
|
41
41
|
module Interface
|
42
42
|
# Trace the given block of code and validate the interface usage.
|
43
43
|
# @parameter name [String] A useful name/annotation for the recorded span.
|
44
|
+
# @parameter resource [String] The context in which the trace operation is occuring.
|
44
45
|
# @parameter attributes [Hash] Metadata for the recorded span.
|
45
|
-
def trace(name, resource:
|
46
|
+
def trace(name, resource: nil, attributes: nil, &block)
|
46
47
|
unless block_given?
|
47
48
|
raise ArgumentError, "No block given!"
|
48
49
|
end
|
@@ -51,10 +52,8 @@ module Traces
|
|
51
52
|
raise ArgumentError, "Invalid name (must be String): #{name.inspect}!"
|
52
53
|
end
|
53
54
|
|
54
|
-
|
55
|
-
|
56
|
-
resource = resource.to_s
|
57
|
-
end
|
55
|
+
# It should be convertable:
|
56
|
+
resource &&= resource.to_s
|
58
57
|
|
59
58
|
context = Context.nested(Fiber.current.traces_backend_context)
|
60
59
|
|
data/lib/traces/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: traces
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
- !ruby/object:Gem::Version
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
|
-
rubygems_version: 3.
|
135
|
+
rubygems_version: 3.1.6
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: Application instrumentation and tracing.
|
metadata.gz.sig
CHANGED
Binary file
|