opentracing 0.3.2 → 0.4.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/README.md +2 -0
- data/lib/opentracing.rb +2 -0
- data/lib/opentracing/scope.rb +23 -0
- data/lib/opentracing/scope_manager.rb +35 -0
- data/lib/opentracing/span.rb +12 -0
- data/lib/opentracing/tracer.rb +56 -8
- data/lib/opentracing/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f48b115cca9cb06fe69b84c5810f07e5491a8f5
|
4
|
+
data.tar.gz: 27a4336744a7c48f18391d0fede2e52f747df80c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5f0868a95ecc7c91eb1f14eed99ab3adb5e00a5439896d7428d0480aaf6edbbd292abf6a2f266da54b4bd987ba7172973537780b09ca6eebb5258a024bbafb2
|
7
|
+
data.tar.gz: d6deb922e5d0be1d8c07c8afa77a131ad6c477e44023f97810b7c2cf2b6899ff9950ee585342210e0a773cd565888c57f652ff4e9f59eafc65905f1fb7c81c90
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.4.0
|
4
|
+
|
5
|
+
* The tracer now implements the OpenTracing Scope API for in-process scope propagation([#21](https://github.com/opentracing/opentracing-ruby/pull/21))
|
6
|
+
* Adds a `log_kv` method and deprecates `log` for consistency with other language implementations. See [#22](https://github.com/opentracing/opentracing-ruby/pull/23).
|
7
|
+
|
3
8
|
## 0.3.2
|
4
9
|
|
5
10
|
* Addressing Ruby style issues ([#14](https://github.com/opentracing/opentracing-ruby/pull/14))
|
6
11
|
* Default to the no-op tracer ([#17](https://github.com/opentracing/opentracing-ruby/pull/17))
|
7
12
|
* Fixing serialization example in README ([#18](https://github.com/opentracing/opentracing-ruby/pull/18))
|
8
|
-
* Removing bundler development version requirement
|
13
|
+
* Removing bundler development version requirement
|
data/README.md
CHANGED
data/lib/opentracing.rb
CHANGED
@@ -4,6 +4,8 @@ require "opentracing/span_context"
|
|
4
4
|
require "opentracing/span"
|
5
5
|
require "opentracing/reference"
|
6
6
|
require "opentracing/tracer"
|
7
|
+
require "opentracing/scope"
|
8
|
+
require "opentracing/scope_manager"
|
7
9
|
|
8
10
|
module OpenTracing
|
9
11
|
# Text format for Tracer#inject and Tracer#extract.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module OpenTracing
|
2
|
+
# Scope represents an OpenTracing Scope
|
3
|
+
#
|
4
|
+
# See http://www.opentracing.io for more information.
|
5
|
+
class Scope
|
6
|
+
NOOP_INSTANCE = Scope.new.freeze
|
7
|
+
|
8
|
+
# Return the Span scoped by this Scope
|
9
|
+
#
|
10
|
+
# @return [Span]
|
11
|
+
def span
|
12
|
+
Span::NOOP_INSTANCE
|
13
|
+
end
|
14
|
+
|
15
|
+
# Mark the end of the active period for the current thread and Scope,
|
16
|
+
# updating the ScopeManager#active in the process.
|
17
|
+
#
|
18
|
+
# NOTE: Calling close more than once on a single Scope instance leads to
|
19
|
+
# undefined behavior.
|
20
|
+
def close
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module OpenTracing
|
2
|
+
# ScopeManager represents an OpenTracing ScopeManager
|
3
|
+
#
|
4
|
+
# See http://www.opentracing.io for more information.
|
5
|
+
#
|
6
|
+
# The ScopeManager interface abstracts both the activation of Span instances
|
7
|
+
# via ScopeManager#activate and access to an active Span/Scope via
|
8
|
+
# ScopeManager#active
|
9
|
+
|
10
|
+
class ScopeManager
|
11
|
+
NOOP_INSTANCE = ScopeManager.new.freeze
|
12
|
+
|
13
|
+
# Make a span instance active.
|
14
|
+
#
|
15
|
+
# @param span [Span] the Span that should become active
|
16
|
+
# @param finish_on_close [Boolean] whether the Span should automatically be
|
17
|
+
# finished when Scope#close is called
|
18
|
+
# @return [Scope] instance to control the end of the active period for the
|
19
|
+
# Span. It is a programming error to neglect to call Scope#close on the
|
20
|
+
# returned instance.
|
21
|
+
def activate(span, finish_on_close: true)
|
22
|
+
Scope::NOOP_INSTANCE
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [Scope] the currently active Scope which can be used to access the
|
26
|
+
# currently active Span.
|
27
|
+
#
|
28
|
+
# If there is a non-null Scope, its wrapped Span becomes an implicit parent
|
29
|
+
# (as Reference#CHILD_OF) of any newly-created Span at Tracer#start_active_span
|
30
|
+
# or Tracer#start_span time.
|
31
|
+
def active
|
32
|
+
Scope::NOOP_INSTANCE
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/opentracing/span.rb
CHANGED
@@ -40,11 +40,23 @@ module OpenTracing
|
|
40
40
|
nil
|
41
41
|
end
|
42
42
|
|
43
|
+
# @deprecated Use {#log_kv} instead.
|
44
|
+
# Reason: event is an optional standard log field defined in spec and not required. Also,
|
45
|
+
# method name {#log_kv} is more consistent with other language implementations such as Python and Go.
|
46
|
+
#
|
43
47
|
# Add a log entry to this span
|
44
48
|
# @param event [String] event name for the log
|
45
49
|
# @param timestamp [Time] time of the log
|
46
50
|
# @param fields [Hash] Additional information to log
|
47
51
|
def log(event: nil, timestamp: Time.now, **fields)
|
52
|
+
warn "Span#log is deprecated. Please use Span#log_kv instead."
|
53
|
+
nil
|
54
|
+
end
|
55
|
+
|
56
|
+
# Add a log entry to this span
|
57
|
+
# @param timestamp [Time] time of the log
|
58
|
+
# @param fields [Hash] Additional information to log
|
59
|
+
def log_kv(timestamp: Time.now, **fields)
|
48
60
|
nil
|
49
61
|
end
|
50
62
|
|
data/lib/opentracing/tracer.rb
CHANGED
@@ -1,25 +1,73 @@
|
|
1
1
|
module OpenTracing
|
2
2
|
class Tracer
|
3
|
-
#
|
3
|
+
# @return [ScopeManager] the current ScopeManager, which may be a no-op but
|
4
|
+
# may not be nil.
|
5
|
+
def scope_manager
|
6
|
+
ScopeManager::NOOP_INSTANCE
|
7
|
+
end
|
8
|
+
|
9
|
+
# Returns a newly started and activated Scope.
|
4
10
|
#
|
5
|
-
#
|
11
|
+
# If the Tracer's ScopeManager#active is not nil, no explicit references
|
12
|
+
# are provided, and `ignore_active_scope` is false, then an inferred
|
13
|
+
# References#CHILD_OF reference is created to the ScopeManager#active's
|
14
|
+
# SpanContext when start_active is invoked.
|
6
15
|
#
|
16
|
+
# @param operation_name [String] The operation name for the Span
|
7
17
|
# @param child_of [SpanContext, Span] SpanContext that acts as a parent to
|
8
18
|
# the newly-started Span. If a Span instance is provided, its
|
9
19
|
# context is automatically substituted. See [Reference] for more
|
10
20
|
# information.
|
11
21
|
#
|
12
|
-
# If specified, the `references`
|
13
|
-
#
|
22
|
+
# If specified, the `references` parameter must be omitted.
|
14
23
|
# @param references [Array<Reference>] An array of reference
|
15
24
|
# objects that identify one or more parent SpanContexts.
|
16
|
-
#
|
17
25
|
# @param start_time [Time] When the Span started, if not now
|
18
|
-
#
|
19
26
|
# @param tags [Hash] Tags to assign to the Span at start time
|
27
|
+
# @param ignore_active_scope [Boolean] whether to create an implicit
|
28
|
+
# References#CHILD_OF reference to the ScopeManager#active.
|
29
|
+
# @param finish_on_close [Boolean] whether span should automatically be
|
30
|
+
# finished when Scope#close is called
|
31
|
+
# @yield [Scope] If an optional block is passed to start_active it will
|
32
|
+
# yield the newly-started Scope. If `finish_on_close` is true then the
|
33
|
+
# Span will be finished automatically after the block is executed.
|
34
|
+
# @return [Scope] The newly-started and activated Scope
|
35
|
+
def start_active_span(operation_name,
|
36
|
+
child_of: nil,
|
37
|
+
references: nil,
|
38
|
+
start_time: Time.now,
|
39
|
+
tags: nil,
|
40
|
+
ignore_active_scope: false,
|
41
|
+
finish_on_close: true)
|
42
|
+
Scope::NOOP_INSTANCE.tap do |scope|
|
43
|
+
yield scope if block_given?
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
# Like #start_active_span, but the returned Span has not been registered via the
|
48
|
+
# ScopeManager.
|
20
49
|
#
|
21
|
-
# @
|
22
|
-
|
50
|
+
# @param operation_name [String] The operation name for the Span
|
51
|
+
# @param child_of [SpanContext, Span] SpanContext that acts as a parent to
|
52
|
+
# the newly-started Span. If a Span instance is provided, its
|
53
|
+
# context is automatically substituted. See [Reference] for more
|
54
|
+
# information.
|
55
|
+
#
|
56
|
+
# If specified, the `references` parameter must be omitted.
|
57
|
+
# @param references [Array<Reference>] An array of reference
|
58
|
+
# objects that identify one or more parent SpanContexts.
|
59
|
+
# @param start_time [Time] When the Span started, if not now
|
60
|
+
# @param tags [Hash] Tags to assign to the Span at start time
|
61
|
+
# @param ignore_active_scope [Boolean] whether to create an implicit
|
62
|
+
# References#CHILD_OF reference to the ScopeManager#active.
|
63
|
+
# @return [Span] the newly-started Span instance, which has not been
|
64
|
+
# automatically registered via the ScopeManager
|
65
|
+
def start_span(operation_name,
|
66
|
+
child_of: nil,
|
67
|
+
references: nil,
|
68
|
+
start_time: Time.now,
|
69
|
+
tags: nil,
|
70
|
+
ignore_active_scope: false)
|
23
71
|
Span::NOOP_INSTANCE
|
24
72
|
end
|
25
73
|
|
data/lib/opentracing/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opentracing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ngauthier
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-
|
13
|
+
date: 2018-03-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -103,6 +103,8 @@ files:
|
|
103
103
|
- lib/opentracing.rb
|
104
104
|
- lib/opentracing/carrier.rb
|
105
105
|
- lib/opentracing/reference.rb
|
106
|
+
- lib/opentracing/scope.rb
|
107
|
+
- lib/opentracing/scope_manager.rb
|
106
108
|
- lib/opentracing/span.rb
|
107
109
|
- lib/opentracing/span_context.rb
|
108
110
|
- lib/opentracing/tracer.rb
|
@@ -123,12 +125,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
125
|
version: '0'
|
124
126
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
127
|
requirements:
|
126
|
-
- - "
|
128
|
+
- - ">"
|
127
129
|
- !ruby/object:Gem::Version
|
128
|
-
version:
|
130
|
+
version: 1.3.1
|
129
131
|
requirements: []
|
130
132
|
rubyforge_project:
|
131
|
-
rubygems_version: 2.4.
|
133
|
+
rubygems_version: 2.4.6
|
132
134
|
signing_key:
|
133
135
|
specification_version: 4
|
134
136
|
summary: OpenTracing Ruby Platform API
|