opentelemetry-api 1.10.1 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/opentelemetry/context.rb +1 -1
- data/lib/opentelemetry/internal/proxy_tracer_provider.rb +40 -7
- data/lib/opentelemetry/trace/propagation/trace_context/trace_parent.rb +2 -0
- data/lib/opentelemetry/trace/trace_flags.rb +1 -1
- data/lib/opentelemetry/trace/tracer.rb +1 -1
- data/lib/opentelemetry/trace/tracer_provider.rb +12 -3
- data/lib/opentelemetry/trace/tracestate.rb +3 -3
- data/lib/opentelemetry/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 54f9aefb3cf00989b6f8ec91622bfcf4ed990bcc898fe8850655a13aa7502153
|
|
4
|
+
data.tar.gz: cdbe2376c9bed2b603dbd6fe0b554a506c2c82f21b340e43cc54368acfebc9e4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5cca57e3ddc7cbe682f1d606d45bd0336e0256f69acce2060d9905d2e5c54e96ff05ee30c5bbba671fa95ed736344873f1af8361f7a3a6ede6bd4ce2ee5a3558
|
|
7
|
+
data.tar.gz: 1ddc9c956939364f9b783abb42660859bbc2020a36d77b4b1cf348b401e1d3736a9b7758b44d7f41ff153db1eb2f102fee6ab708b555b79b05a35e1463068b63
|
data/CHANGELOG.md
CHANGED
|
@@ -15,7 +15,7 @@ module OpenTelemetry # rubocop:disable Style/Documentation
|
|
|
15
15
|
EMPTY_ENTRIES = {}.freeze
|
|
16
16
|
private_constant :EMPTY_ENTRIES
|
|
17
17
|
|
|
18
|
-
DetachError = Class.new(OpenTelemetry::Error)
|
|
18
|
+
DetachError = Class.new(OpenTelemetry::Error) # rubocop:disable Style/EmptyClassDefinition
|
|
19
19
|
|
|
20
20
|
class << self
|
|
21
21
|
# Returns a key used to index a value in a Context
|
|
@@ -13,9 +13,22 @@ module OpenTelemetry
|
|
|
13
13
|
# It delegates to a "real" TracerProvider after the global tracer provider is registered.
|
|
14
14
|
# It returns {ProxyTracer} instances until the delegate is installed.
|
|
15
15
|
class ProxyTracerProvider < Trace::TracerProvider
|
|
16
|
-
Key = Struct.new(:name, :version)
|
|
16
|
+
Key = Struct.new(:name, :version, :attributes)
|
|
17
17
|
private_constant(:Key)
|
|
18
18
|
|
|
19
|
+
# Wraps a legacy TracerProvider whose `#tracer` method does not accept
|
|
20
|
+
# the `attributes:` keyword argument, dropping the argument on delegation.
|
|
21
|
+
class LegacyProviderWrapper
|
|
22
|
+
def initialize(legacy_provider)
|
|
23
|
+
@legacy_provider = legacy_provider
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def tracer(name = nil, version = nil, attributes: nil)
|
|
27
|
+
@legacy_provider.tracer(name, version)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
private_constant(:LegacyProviderWrapper)
|
|
31
|
+
|
|
19
32
|
# Returns a new {ProxyTracerProvider} instance.
|
|
20
33
|
#
|
|
21
34
|
# @return [ProxyTracerProvider]
|
|
@@ -35,25 +48,45 @@ module OpenTelemetry
|
|
|
35
48
|
return
|
|
36
49
|
end
|
|
37
50
|
|
|
51
|
+
provider = LegacyProviderWrapper.new(provider) unless supports_attributes?(provider)
|
|
52
|
+
|
|
38
53
|
@mutex.synchronize do
|
|
39
54
|
@delegate = provider
|
|
40
|
-
@registry.each { |key, tracer| tracer.delegate =
|
|
55
|
+
@registry.each { |key, tracer| tracer.delegate = @delegate.tracer(key.name, key.version, attributes: key.attributes) }
|
|
41
56
|
end
|
|
42
57
|
end
|
|
43
58
|
|
|
44
59
|
# Returns a {Tracer} instance.
|
|
45
60
|
#
|
|
46
|
-
#
|
|
47
|
-
#
|
|
61
|
+
# Supports both positional arguments (legacy) and keyword arguments:
|
|
62
|
+
# tracer('name', '1.0') # legacy positional
|
|
63
|
+
# tracer(name: 'name', version: '1.0', attributes: {...}) # keyword
|
|
64
|
+
#
|
|
65
|
+
# When both positional and keyword arguments are provided for the same
|
|
66
|
+
# parameter, the keyword argument takes precedence.
|
|
67
|
+
#
|
|
68
|
+
# @param [String] name Instrumentation scope name
|
|
69
|
+
# @param [String] version Instrumentation scope version
|
|
70
|
+
# @param [Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}] attributes
|
|
71
|
+
# Instrumentation scope attributes
|
|
48
72
|
#
|
|
49
73
|
# @return [Tracer]
|
|
50
|
-
def tracer(
|
|
74
|
+
def tracer(deprecated_name = nil, deprecated_version = nil, name: nil, version: nil, attributes: nil)
|
|
75
|
+
name ||= deprecated_name
|
|
76
|
+
version ||= deprecated_version
|
|
51
77
|
@mutex.synchronize do
|
|
52
|
-
return @delegate.tracer(name, version) unless @delegate.nil?
|
|
78
|
+
return @delegate.tracer(name, version, attributes: attributes) unless @delegate.nil?
|
|
53
79
|
|
|
54
|
-
@registry[Key.new(name, version)] ||= ProxyTracer.new
|
|
80
|
+
@registry[Key.new(name, version, attributes)] ||= ProxyTracer.new
|
|
55
81
|
end
|
|
56
82
|
end
|
|
83
|
+
|
|
84
|
+
private
|
|
85
|
+
|
|
86
|
+
def supports_attributes?(provider)
|
|
87
|
+
provider.respond_to?(:tracer) &&
|
|
88
|
+
provider.method(:tracer).parameters.any? { |_, n| n == :attributes }
|
|
89
|
+
end
|
|
57
90
|
end
|
|
58
91
|
end
|
|
59
92
|
end
|
|
@@ -11,10 +11,12 @@ module OpenTelemetry
|
|
|
11
11
|
# https://www.w3.org/TR/trace-context/
|
|
12
12
|
# {Trace::SpanContext}
|
|
13
13
|
class TraceParent
|
|
14
|
+
# rubocop:disable Style/EmptyClassDefinition
|
|
14
15
|
InvalidFormatError = Class.new(Error)
|
|
15
16
|
InvalidVersionError = Class.new(Error)
|
|
16
17
|
InvalidTraceIDError = Class.new(Error)
|
|
17
18
|
InvalidSpanIDError = Class.new(Error)
|
|
19
|
+
# rubocop:enable Style/EmptyClassDefinition
|
|
18
20
|
|
|
19
21
|
TRACE_PARENT_HEADER = 'traceparent'
|
|
20
22
|
SUPPORTED_VERSION = 0
|
|
@@ -34,7 +34,7 @@ module OpenTelemetry
|
|
|
34
34
|
def in_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil, record_exception: true)
|
|
35
35
|
span = nil
|
|
36
36
|
span = start_span(name, attributes: attributes, links: links, start_timestamp: start_timestamp, kind: kind)
|
|
37
|
-
Trace.with_span(span) { |s, c| yield s, c }
|
|
37
|
+
Trace.with_span(span) { |s, c| yield s, c } # rubocop:disable Style/ExplicitBlockArgument
|
|
38
38
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
|
39
39
|
span&.record_exception(e) if record_exception
|
|
40
40
|
span&.status = Status.error("Unhandled exception of type: #{e.class}")
|
|
@@ -10,11 +10,20 @@ module OpenTelemetry
|
|
|
10
10
|
class TracerProvider
|
|
11
11
|
# Returns a {Tracer} instance.
|
|
12
12
|
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
13
|
+
# Supports both positional arguments (legacy) and keyword arguments:
|
|
14
|
+
# tracer('name', '1.0') # legacy positional
|
|
15
|
+
# tracer(name: 'name', version: '1.0', attributes: {...}) # keyword
|
|
16
|
+
#
|
|
17
|
+
# When both positional and keyword arguments are provided for the same
|
|
18
|
+
# parameter, the keyword argument takes precedence.
|
|
19
|
+
#
|
|
20
|
+
# @param [String] name Instrumentation scope name
|
|
21
|
+
# @param [String] version Instrumentation scope version
|
|
22
|
+
# @param [Hash{String => String, Numeric, Boolean, Array<String, Numeric, Boolean>}] attributes
|
|
23
|
+
# Instrumentation scope attributes
|
|
15
24
|
#
|
|
16
25
|
# @return [Tracer]
|
|
17
|
-
def tracer(
|
|
26
|
+
def tracer(deprecated_name = nil, deprecated_version = nil, name: nil, version: nil, attributes: nil)
|
|
18
27
|
@tracer ||= Tracer.new
|
|
19
28
|
end
|
|
20
29
|
end
|
|
@@ -75,7 +75,7 @@ module OpenTelemetry
|
|
|
75
75
|
# @return [Tracestate]
|
|
76
76
|
def initialize(hash)
|
|
77
77
|
excess = hash.size - MAX_MEMBER_COUNT
|
|
78
|
-
hash =
|
|
78
|
+
hash = hash.drop(excess).to_h if excess.positive?
|
|
79
79
|
@hash = hash.freeze
|
|
80
80
|
end
|
|
81
81
|
|
|
@@ -105,7 +105,7 @@ module OpenTelemetry
|
|
|
105
105
|
return self
|
|
106
106
|
end
|
|
107
107
|
|
|
108
|
-
h =
|
|
108
|
+
h = @hash.to_h.dup
|
|
109
109
|
h[key] = value
|
|
110
110
|
self.class.create(h)
|
|
111
111
|
end
|
|
@@ -118,7 +118,7 @@ module OpenTelemetry
|
|
|
118
118
|
def delete(key)
|
|
119
119
|
return self unless @hash.key?(key)
|
|
120
120
|
|
|
121
|
-
h =
|
|
121
|
+
h = @hash.to_h.dup
|
|
122
122
|
h.delete(key)
|
|
123
123
|
self.class.create(h)
|
|
124
124
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: opentelemetry-api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.11.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OpenTelemetry Authors
|
|
@@ -88,10 +88,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
|
|
88
88
|
licenses:
|
|
89
89
|
- Apache-2.0
|
|
90
90
|
metadata:
|
|
91
|
-
changelog_uri: https://rubydoc.info/gems/opentelemetry-api/1.
|
|
92
|
-
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/opentelemetry-api/v1.
|
|
91
|
+
changelog_uri: https://rubydoc.info/gems/opentelemetry-api/1.11.0/file/CHANGELOG.md
|
|
92
|
+
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/opentelemetry-api/v1.11.0/api
|
|
93
93
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
|
94
|
-
documentation_uri: https://rubydoc.info/gems/opentelemetry-api/1.
|
|
94
|
+
documentation_uri: https://rubydoc.info/gems/opentelemetry-api/1.11.0
|
|
95
95
|
rdoc_options: []
|
|
96
96
|
require_paths:
|
|
97
97
|
- lib
|
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
106
106
|
- !ruby/object:Gem::Version
|
|
107
107
|
version: '0'
|
|
108
108
|
requirements: []
|
|
109
|
-
rubygems_version: 4.0.
|
|
109
|
+
rubygems_version: 4.0.16
|
|
110
110
|
specification_version: 4
|
|
111
111
|
summary: A stats collection and distributed tracing framework
|
|
112
112
|
test_files: []
|