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 +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/opentelemetry/context/propagation/composite_text_map_propagator.rb +1 -1
- data/lib/opentelemetry/context/propagation/rack_env_getter.rb +2 -2
- data/lib/opentelemetry/trace/status.rb +1 -1
- data/lib/opentelemetry/trace/trace_flags.rb +1 -1
- data/lib/opentelemetry/trace/tracer.rb +2 -2
- data/lib/opentelemetry/trace/tracestate.rb +5 -2
- data/lib/opentelemetry/trace.rb +3 -13
- data/lib/opentelemetry/version.rb +1 -1
- data/lib/opentelemetry.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5400a18cd6777fa998c3d664fdc51842c56ea59afe213529bce195c0bb41e4ba
|
4
|
+
data.tar.gz: bd680b47e192fced89f66b6cf5c088247604f2126cc39663eba1d15eba1bcba6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef4da06339512cceeae5d8760e6d97e07a8686943ce3373da8c4051d5f0d80f8eb5d91d627306f07bb5a25e512ed20dbda006a7178f469d718193d1ce88265f7
|
7
|
+
data.tar.gz: d7d3685c0d113abaef164785d2609985c78eaa92755f87f60674f8fcc76e4e2f487bc108b638bf7790d1dd42894eb75118f5e23e8bf3cf09370a9b1fa5647909
|
data/CHANGELOG.md
CHANGED
@@ -14,7 +14,7 @@ module OpenTelemetry
|
|
14
14
|
# initialization.
|
15
15
|
class CompositeTextMapPropagator
|
16
16
|
class << self
|
17
|
-
private :new
|
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
|
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
|
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
|
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
|
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
|
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
|
-
|
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
|
data/lib/opentelemetry/trace.rb
CHANGED
@@ -13,17 +13,7 @@ module OpenTelemetry
|
|
13
13
|
|
14
14
|
CURRENT_SPAN_KEY = Context.create_key('current-span')
|
15
15
|
|
16
|
-
|
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 =
|
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 =
|
41
|
+
id = Random.bytes(8)
|
52
42
|
return id unless id == INVALID_SPAN_ID
|
53
43
|
end
|
54
44
|
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(
|
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
|
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-
|
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:
|
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:
|
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
|
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
|
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.
|
216
|
+
version: 2.6.0
|
217
217
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
218
218
|
requirements:
|
219
219
|
- - ">="
|