opentelemetry-api 1.0.2 → 1.1.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: 85960a6afb5657aa62490a88b174a18f17592ef4bff6b0be5a4dc07cd86f50fd
4
- data.tar.gz: e9f6492ede00c699ccb7d2d05a6bb161f37196be55e5a73830b6799ad6a1af5e
3
+ metadata.gz: 5400a18cd6777fa998c3d664fdc51842c56ea59afe213529bce195c0bb41e4ba
4
+ data.tar.gz: bd680b47e192fced89f66b6cf5c088247604f2126cc39663eba1d15eba1bcba6
5
5
  SHA512:
6
- metadata.gz: '09097da2630ecd44d805690f28ddb8ea65ad59b70dfc40031f85fb271abf46213b37b44463d5430853d7a033d5e7a4f52a72304c4236575a0a29c8940231d013'
7
- data.tar.gz: e7aebf486eb2021ee30ea4045f343e02bdddb49c20a9feeb8973c394aa0cdc55c0474ff3cd5e7693f3f620432f6c5db9a9beb3a4e10b49a1b5056e48d0588470
6
+ metadata.gz: ef4da06339512cceeae5d8760e6d97e07a8686943ce3373da8c4051d5f0d80f8eb5d91d627306f07bb5a25e512ed20dbda006a7178f469d718193d1ce88265f7
7
+ data.tar.gz: d7d3685c0d113abaef164785d2609985c78eaa92755f87f60674f8fcc76e4e2f487bc108b638bf7790d1dd42894eb75118f5e23e8bf3cf09370a9b1fa5647909
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Release History: opentelemetry-api
2
2
 
3
+ ### v1.1.0 / 2022-09-14
4
+
5
+ * ADDED: Consistent probability sampler
6
+ * FIXED: Get API onto rubocop 1.3
7
+
3
8
  ### v1.0.2 / 2022-05-02
4
9
 
5
10
  * FIXED: Text map propagator extraction should use argument context
@@ -14,7 +14,7 @@ module OpenTelemetry
14
14
  # initialization.
15
15
  class CompositeTextMapPropagator
16
16
  class << self
17
- private :new # rubocop:disable Style/AccessModifierDeclarations
17
+ private :new
18
18
 
19
19
  # Returns a Propagator that extracts using the provided extractors
20
20
  # and injectors.
@@ -32,7 +32,7 @@ module OpenTelemetry
32
32
  private
33
33
 
34
34
  def to_rack_key(key)
35
- ret = 'HTTP_' + key
35
+ ret = 'HTTP_' + key # rubocop:disable Style/StringConcatenation
36
36
  ret.tr!('-', '_')
37
37
  ret.upcase!
38
38
  ret
@@ -40,7 +40,7 @@ module OpenTelemetry
40
40
 
41
41
  def from_rack_key(key)
42
42
  start = key.start_with?('HTTP_') ? 5 : 0
43
- ret = key[start..-1]
43
+ ret = key[start..]
44
44
  ret.tr!('_', '-')
45
45
  ret.downcase!
46
46
  ret
@@ -10,7 +10,7 @@ module OpenTelemetry
10
10
  # status code in conjunction with an optional descriptive message.
11
11
  class Status
12
12
  class << self
13
- private :new # rubocop:disable Style/AccessModifierDeclarations
13
+ private :new
14
14
 
15
15
  # Returns a newly created {Status} with code == UNSET and an optional
16
16
  # description.
@@ -11,7 +11,7 @@ module OpenTelemetry
11
11
  # boolean {sampled?} {https://www.w3.org/TR/trace-context/#trace-flags flag}.
12
12
  class TraceFlags
13
13
  class << self
14
- private :new # rubocop:disable Style/AccessModifierDeclarations
14
+ private :new
15
15
 
16
16
  # Returns a newly created {TraceFlags} with the specified flags.
17
17
  #
@@ -23,10 +23,10 @@ module OpenTelemetry
23
23
  # span and reraised.
24
24
  # @yield [span, context] yields the newly created span and a context containing the
25
25
  # span to the block.
26
- def in_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil)
26
+ def in_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil, &block)
27
27
  span = nil
28
28
  span = start_span(name, attributes: attributes, links: links, start_timestamp: start_timestamp, kind: kind)
29
- Trace.with_span(span) { |s, c| yield s, c }
29
+ Trace.with_span(span, &block)
30
30
  rescue Exception => e # rubocop:disable Lint/RescueException
31
31
  span&.record_exception(e)
32
32
  span&.status = Status.error("Unhandled exception of type: #{e.class}")
@@ -11,7 +11,7 @@ module OpenTelemetry
11
11
  # specification https://www.w3.org/TR/trace-context/
12
12
  class Tracestate
13
13
  class << self
14
- private :new # rubocop:disable Style/AccessModifierDeclarations
14
+ private :new
15
15
 
16
16
  # Returns a newly created Tracestate parsed from the header provided.
17
17
  #
@@ -100,7 +100,10 @@ module OpenTelemetry
100
100
  # @return [Tracestate] self, if unchanged, or a new Tracestate containing
101
101
  # the new or updated key/value pair.
102
102
  def set_value(key, value)
103
- return self unless VALID_KEY.match?(key) && VALID_VALUE.match?(value)
103
+ unless VALID_KEY.match?(key) && VALID_VALUE.match?(value)
104
+ OpenTelemetry.logger.debug("Invalid Tracestate member - #{key} : #{value}")
105
+ return self
106
+ end
104
107
 
105
108
  h = Hash[@hash]
106
109
  h[key] = value
@@ -13,17 +13,7 @@ module OpenTelemetry
13
13
 
14
14
  CURRENT_SPAN_KEY = Context.create_key('current-span')
15
15
 
16
- # Random number generator for generating IDs. This is an object that can
17
- # respond to `#bytes` and uses the system PRNG. The current logic is
18
- # compatible with Ruby 2.5 (which does not implement the `Random.bytes`
19
- # class method) and with Ruby 3.0+ (which deprecates `Random::DEFAULT`).
20
- # When we drop support for Ruby 2.5, this can simply be replaced with
21
- # the class `Random`.
22
- #
23
- # @return [#bytes]
24
- RANDOM = Random.respond_to?(:bytes) ? Random : Random::DEFAULT
25
-
26
- private_constant :CURRENT_SPAN_KEY, :RANDOM
16
+ private_constant :CURRENT_SPAN_KEY
27
17
 
28
18
  # An invalid trace identifier, a 16-byte string with all zero bytes.
29
19
  INVALID_TRACE_ID = ("\0" * 16).b
@@ -37,7 +27,7 @@ module OpenTelemetry
37
27
  # @return [String] a valid trace ID.
38
28
  def generate_trace_id
39
29
  loop do
40
- id = RANDOM.bytes(16)
30
+ id = Random.bytes(16)
41
31
  return id unless id == INVALID_TRACE_ID
42
32
  end
43
33
  end
@@ -48,7 +38,7 @@ module OpenTelemetry
48
38
  # @return [String] a valid span ID.
49
39
  def generate_span_id
50
40
  loop do
51
- id = RANDOM.bytes(8)
41
+ id = Random.bytes(8)
52
42
  return id unless id == INVALID_SPAN_ID
53
43
  end
54
44
  end
@@ -6,5 +6,5 @@
6
6
 
7
7
  module OpenTelemetry
8
8
  ## Current OpenTelemetry version
9
- VERSION = '1.0.2'
9
+ VERSION = '1.1.0'
10
10
  end
data/lib/opentelemetry.rb CHANGED
@@ -28,7 +28,7 @@ module OpenTelemetry
28
28
 
29
29
  # @return [Object, Logger] configured Logger or a default STDOUT Logger.
30
30
  def logger
31
- @logger ||= Logger.new(STDOUT, level: ENV['OTEL_LOG_LEVEL'] || Logger::INFO)
31
+ @logger ||= Logger.new($stdout, level: ENV['OTEL_LOG_LEVEL'] || Logger::INFO)
32
32
  end
33
33
 
34
34
  # @return [Callable] configured error handler or a default that logs the
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-02 00:00:00.000000000 Z
11
+ date: 2022-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ipsa
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 0.73.0
103
+ version: '1.30'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 0.73.0
110
+ version: '1.30'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: simplecov
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -201,10 +201,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
201
201
  licenses:
202
202
  - Apache-2.0
203
203
  metadata:
204
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-api/v1.0.2/file.CHANGELOG.html
204
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-api/v1.1.0/file.CHANGELOG.html
205
205
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/api
206
206
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
207
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-api/v1.0.2
207
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-api/v1.1.0
208
208
  post_install_message:
209
209
  rdoc_options: []
210
210
  require_paths:
@@ -213,7 +213,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
213
213
  requirements:
214
214
  - - ">="
215
215
  - !ruby/object:Gem::Version
216
- version: 2.5.0
216
+ version: 2.6.0
217
217
  required_rubygems_version: !ruby/object:Gem::Requirement
218
218
  requirements:
219
219
  - - ">="