opentracing 0.4.3 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b098877231da8a45c53d373b62f2c9fde240fbea9c036206f85e206dce9cca4b
4
- data.tar.gz: 76ceff6bdc3b43ee8aeff06804f149bab3b9d50a3a13166c84c42e1b13b09ed2
3
+ metadata.gz: a1afd30cdd521cbc991fb90ac3249941cffb92ce520971e9e30def058518f810
4
+ data.tar.gz: 57d94238f74b7e2e1e24dd6d902848263b1fa043a94eced9df5c176f2a906b2c
5
5
  SHA512:
6
- metadata.gz: 354d5fbea56a5e6281145cbfc1dc586368c82673fa20d71539a51e5a45b580b49474b791bfe5b42403593a6a1e46864c16f6ccb3d41d6ce6682d1ce25de0cb30
7
- data.tar.gz: 0657b98ddee67240e2078703c3fd1dd6d61da567399368980909ad02ab02d7bd74e6f8fd0037d4763aec7e72d178b0cd58f888a30fcbb031c326372472250bb2
6
+ metadata.gz: cb204bb822af323dc789bddf74d8acaa182621068358c0b681eaf8210e83e8ed654c53e311a5d867a908bd4c962a591d473be54dd5c5bd983987d1ee498f2018
7
+ data.tar.gz: d11c2bd895bbf11eda1f85bc01d0b4b90afa25bbdb11a3c99d99971e3ac140786fb8dc2680d2c9da52962cc3c0b959a66c30231107ad083f3e904006fef6c62e
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.0
4
+
5
+ * Tracer#start_span now accepts an optional block. When passed a block, it returns the block's return value, otherwise it returns the newly-created span ([#45](https://github.com/opentracing/opentracing-ruby/pull/45)). See [Issue #13](https://github.com/opentracing/opentracing-ruby/issues/13).
6
+
7
+ * When passed an optional block, Tracer#start_active_span returns the block's return value, otherwise it returns the newly-created scope. This is a change in behavior as it previously returned a scope in both cases([#45](https://github.com/opentracing/opentracing-ruby/pull/45)). See [Issue #41](https://github.com/opentracing/opentracing-ruby/issues/41).
8
+
9
+ * Improved documentation for `log` and `log_kv` methods ([#44](https://github.com/opentracing/opentracing-ruby/pull/44))
10
+
3
11
  ## 0.4.3
4
12
 
5
13
  * Specify versions for development dependencies ([#40](https://github.com/opentracing/opentracing-ruby/pull/40))
@@ -46,7 +46,7 @@ module OpenTracing
46
46
  # Add a log entry to this span
47
47
  # @param event [String] event name for the log
48
48
  # @param timestamp [Time] time of the log
49
- # @param fields [Hash] Additional information to log
49
+ # @param fields [Hash{Symbol=>Object}] Additional information to log
50
50
  def log(event: nil, timestamp: Time.now, **fields)
51
51
  warn 'Span#log is deprecated. Please use Span#log_kv instead.'
52
52
  nil
@@ -54,7 +54,7 @@ module OpenTracing
54
54
 
55
55
  # Add a log entry to this span
56
56
  # @param timestamp [Time] time of the log
57
- # @param fields [Hash] Additional information to log
57
+ # @param fields [Hash{Symbol=>Object}] Additional information to log
58
58
  def log_kv(timestamp: Time.now, **fields)
59
59
  nil
60
60
  end
@@ -42,10 +42,12 @@ module OpenTracing
42
42
  # References#CHILD_OF reference to the ScopeManager#active.
43
43
  # @param finish_on_close [Boolean] whether span should automatically be
44
44
  # finished when Scope#close is called
45
- # @yield [Scope] If an optional block is passed to start_active it will
45
+ # @yield [Scope] If an optional block is passed to start_active_span it will
46
46
  # yield the newly-started Scope. If `finish_on_close` is true then the
47
47
  # Span will be finished automatically after the block is executed.
48
- # @return [Scope] The newly-started and activated Scope
48
+ # @return [Scope, Object] If passed an optional block, start_active_span
49
+ # returns the block's return value, otherwise it returns the newly-started
50
+ # and activated Scope
49
51
  def start_active_span(operation_name,
50
52
  child_of: nil,
51
53
  references: nil,
@@ -54,7 +56,7 @@ module OpenTracing
54
56
  ignore_active_scope: false,
55
57
  finish_on_close: true)
56
58
  Scope::NOOP_INSTANCE.tap do |scope|
57
- yield scope if block_given?
59
+ return yield scope if block_given?
58
60
  end
59
61
  end
60
62
 
@@ -74,15 +76,22 @@ module OpenTracing
74
76
  # @param tags [Hash] Tags to assign to the Span at start time
75
77
  # @param ignore_active_scope [Boolean] whether to create an implicit
76
78
  # References#CHILD_OF reference to the ScopeManager#active.
77
- # @return [Span] the newly-started Span instance, which has not been
78
- # automatically registered via the ScopeManager
79
+ # @yield [Span] If passed an optional block, start_span will yield the
80
+ # newly-created span to the block. The span will be finished automatically
81
+ # after the block is executed.
82
+ # @return [Span, Object] If passed an optional block, start_span will return
83
+ # the block's return value, otherwise it returns the newly-started Span
84
+ # instance, which has not been automatically registered via the
85
+ # ScopeManager
79
86
  def start_span(operation_name,
80
87
  child_of: nil,
81
88
  references: nil,
82
89
  start_time: Time.now,
83
90
  tags: nil,
84
91
  ignore_active_scope: false)
85
- Span::NOOP_INSTANCE
92
+ Span::NOOP_INSTANCE.tap do |span|
93
+ return yield span if block_given?
94
+ end
86
95
  end
87
96
 
88
97
  # Inject a SpanContext into the given carrier
@@ -1,3 +1,3 @@
1
1
  module OpenTracing
2
- VERSION = '0.4.3'.freeze
2
+ VERSION = '0.5.0'.freeze
3
3
  end
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.3
4
+ version: 0.5.0
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-10-24 00:00:00.000000000 Z
13
+ date: 2019-01-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: minitest