opentelemetry-api 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/opentelemetry/correlation_context/propagation.rb +2 -2
- data/lib/opentelemetry/correlation_context/propagation/text_extractor.rb +1 -1
- data/lib/opentelemetry/correlation_context/propagation/text_injector.rb +1 -1
- data/lib/opentelemetry/instrumentation.rb +2 -2
- data/lib/opentelemetry/instrumentation/{adapter.rb → base.rb} +54 -53
- data/lib/opentelemetry/instrumentation/registry.rb +32 -32
- data/lib/opentelemetry/trace.rb +12 -14
- data/lib/opentelemetry/trace/propagation/trace_context/trace_parent.rb +9 -5
- data/lib/opentelemetry/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1615af5677eaafab347128c1c887cbcc9aae43216b3d14705e3ac4e1e0f19813
|
4
|
+
data.tar.gz: 8476d0abf68fd2cd2ed9fd5a688b6e70cdf0dc039f4a53216a9086361a069959
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f68b6dde83c283f935bad1ef35ac2ce8add945be714b249b01bbfcb8d0fd17c2afdb97b499a463112eb0929247ba362f4cca464f54b1277ebf693b32bf23750f
|
7
|
+
data.tar.gz: bd3756833a94fed1d20a7de3eabdd65d59157eef045dcce359ec5811796b4468d6ba23b1f05973293dd0c8939e6b9ace4dbcc0ca94c482b81dcddcb006df0ec6
|
@@ -18,10 +18,10 @@ module OpenTelemetry
|
|
18
18
|
TEXT_EXTRACTOR = TextExtractor.new
|
19
19
|
TEXT_INJECTOR = TextInjector.new
|
20
20
|
RACK_EXTRACTOR = TextExtractor.new(
|
21
|
-
correlation_context_key: '
|
21
|
+
correlation_context_key: 'HTTP_OTCORRELATIONS'
|
22
22
|
)
|
23
23
|
RACK_INJECTOR = TextInjector.new(
|
24
|
-
correlation_context_key: '
|
24
|
+
correlation_context_key: 'HTTP_OTCORRELATIONS'
|
25
25
|
)
|
26
26
|
|
27
27
|
private_constant :TEXT_INJECTOR, :TEXT_EXTRACTOR, :RACK_INJECTOR,
|
@@ -19,7 +19,7 @@ module OpenTelemetry
|
|
19
19
|
# @param [String] correlation_context_key The correlation context header
|
20
20
|
# key used in the carrier
|
21
21
|
# @return [TextExtractor]
|
22
|
-
def initialize(correlation_context_key: '
|
22
|
+
def initialize(correlation_context_key: 'otcorrelations')
|
23
23
|
@correlation_context_key = correlation_context_key
|
24
24
|
end
|
25
25
|
|
@@ -19,7 +19,7 @@ module OpenTelemetry
|
|
19
19
|
# @param [String] correlation_context_header_key The correlation context header
|
20
20
|
# key used in the carrier
|
21
21
|
# @return [TextInjector]
|
22
|
-
def initialize(correlation_context_key: '
|
22
|
+
def initialize(correlation_context_key: 'otcorrelations')
|
23
23
|
@correlation_context_key = correlation_context_key
|
24
24
|
end
|
25
25
|
|
@@ -5,11 +5,11 @@
|
|
5
5
|
# SPDX-License-Identifier: Apache-2.0
|
6
6
|
|
7
7
|
require 'opentelemetry/instrumentation/registry'
|
8
|
-
require 'opentelemetry/instrumentation/
|
8
|
+
require 'opentelemetry/instrumentation/base'
|
9
9
|
|
10
10
|
module OpenTelemetry
|
11
11
|
# The instrumentation module contains functionality to register and install
|
12
|
-
# instrumentation
|
12
|
+
# instrumentation
|
13
13
|
module Instrumentation
|
14
14
|
end
|
15
15
|
end
|
@@ -6,20 +6,20 @@
|
|
6
6
|
|
7
7
|
module OpenTelemetry
|
8
8
|
module Instrumentation
|
9
|
-
# The
|
10
|
-
# instrumentation
|
11
|
-
# include a subclass of +Instrumentation::
|
9
|
+
# The Base class holds all metadata and configuration for an
|
10
|
+
# instrumentation. All instrumentation packages should
|
11
|
+
# include a subclass of +Instrumentation::Base+ that will register
|
12
12
|
# it with +OpenTelemetry.instrumentation_registry+ and make it available for
|
13
13
|
# discovery and installation by an SDK.
|
14
14
|
#
|
15
|
-
# A typical subclass of
|
15
|
+
# A typical subclass of Base will provide an install block, a present
|
16
16
|
# block, and possibly a compatible block. Below is an
|
17
17
|
# example:
|
18
18
|
#
|
19
19
|
# module OpenTelemetry
|
20
|
-
# module
|
20
|
+
# module Instrumentation
|
21
21
|
# module Sinatra
|
22
|
-
# class
|
22
|
+
# class Instrumentation < OpenTelemetry::Instrumentation::Base
|
23
23
|
# install do |config|
|
24
24
|
# # install instrumentation, either by library hook or applying
|
25
25
|
# # a monkey patch
|
@@ -39,27 +39,27 @@ module OpenTelemetry
|
|
39
39
|
# end
|
40
40
|
# end
|
41
41
|
#
|
42
|
-
# The
|
43
|
-
# class. In this example, they'd be 'OpenTelemetry::
|
44
|
-
# OpenTelemetry::
|
45
|
-
# the +
|
42
|
+
# The instrumentation name and version will be inferred from the namespace of the
|
43
|
+
# class. In this example, they'd be 'OpenTelemetry::Instrumentation::Sinatra' and
|
44
|
+
# OpenTelemetry::Instrumentation::Sinatra::VERSION, but can be explicitly set using
|
45
|
+
# the +instrumentation_name+ and +instrumetation_version+ methods if necessary.
|
46
46
|
#
|
47
|
-
# All subclasses of OpenTelemetry::Instrumentation::
|
47
|
+
# All subclasses of OpenTelemetry::Instrumentation::Base are automatically
|
48
48
|
# registered with OpenTelemetry.instrumentation_registry which is used by
|
49
49
|
# SDKs for instrumentation discovery and installation.
|
50
50
|
#
|
51
|
-
# Instrumentation libraries can use the
|
51
|
+
# Instrumentation libraries can use the instrumentation subclass to easily gain
|
52
52
|
# a reference to its named tracer. For example:
|
53
53
|
#
|
54
|
-
# OpenTelemetry::
|
54
|
+
# OpenTelemetry::Instrumentation::Sinatra.instance.tracer
|
55
55
|
#
|
56
|
-
# The
|
57
|
-
# by environment variable and local configuration. An
|
56
|
+
# The instrumention class establishes a convention for disabling an instrumentation
|
57
|
+
# by environment variable and local configuration. An instrumentation disabled
|
58
58
|
# by environment variable will take precedence over local config. The
|
59
59
|
# convention for environment variable name is the library name, upcased with
|
60
|
-
# '::' replaced by underscores, and '_ENABLED' appended.
|
61
|
-
#
|
62
|
-
class
|
60
|
+
# '::' replaced by underscores, OPENTELEMETRY shortened to OTEL_{LANG}, and '_ENABLED' appended.
|
61
|
+
# For example: OTEL_RUBY_INSTRUMENTATION_SINATRA_ENABLED = false.
|
62
|
+
class Base
|
63
63
|
class << self
|
64
64
|
NAME_REGEX = /^(?:(?<namespace>[a-zA-Z0-9_:]+):{2})?(?<classname>[a-zA-Z0-9_]+)$/.freeze
|
65
65
|
private_constant :NAME_REGEX
|
@@ -70,67 +70,67 @@ module OpenTelemetry
|
|
70
70
|
OpenTelemetry.instrumentation_registry.register(subclass)
|
71
71
|
end
|
72
72
|
|
73
|
-
# Optionally set the name of this instrumentation
|
73
|
+
# Optionally set the name of this instrumentation. If not
|
74
74
|
# explicitly set, the name will default to the namespace of the class,
|
75
75
|
# or the class name if it does not have a namespace. If there is not
|
76
76
|
# a namespace, or a class name, it will default to 'unknown'.
|
77
77
|
#
|
78
|
-
# @param [String]
|
79
|
-
def
|
80
|
-
if
|
81
|
-
@
|
78
|
+
# @param [String] instrumentation_name The full name of the instrumentation package
|
79
|
+
def instrumentation_name(instrumentation_name = nil)
|
80
|
+
if instrumentation_name
|
81
|
+
@instrumentation_name = instrumentation_name
|
82
82
|
else
|
83
|
-
@
|
83
|
+
@instrumentation_name ||= infer_name || 'unknown'
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
# Optionally set the version of this
|
87
|
+
# Optionally set the version of this instrumentation. If not explicitly set,
|
88
88
|
# the version will default to the VERSION constant under namespace of
|
89
89
|
# the class, or the VERSION constant under the class name if it does not
|
90
90
|
# have a namespace. If a VERSION constant cannot be found, it defaults
|
91
91
|
# to '0.0.0'.
|
92
92
|
#
|
93
|
-
# @param [String]
|
94
|
-
def
|
95
|
-
if
|
96
|
-
@
|
93
|
+
# @param [String] instrumentation_version The version of the instrumentation package
|
94
|
+
def instrumentation_version(instrumentation_version = nil)
|
95
|
+
if instrumentation_version
|
96
|
+
@instrumentation_version = instrumentation_version
|
97
97
|
else
|
98
|
-
@
|
98
|
+
@instrumentation_version ||= infer_version || '0.0.0'
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
-
# The install block for this
|
102
|
+
# The install block for this instrumentation. This will be where you install
|
103
103
|
# instrumentation, either by framework hook or applying a monkey patch.
|
104
104
|
#
|
105
|
-
# @param [Callable] blk The install block for this
|
106
|
-
# @yieldparam [Hash] config The
|
105
|
+
# @param [Callable] blk The install block for this instrumentation
|
106
|
+
# @yieldparam [Hash] config The instrumentation config will be yielded to the
|
107
107
|
# install block
|
108
108
|
def install(&blk)
|
109
109
|
@install_blk = blk
|
110
110
|
end
|
111
111
|
|
112
|
-
# The present block for this
|
112
|
+
# The present block for this instrumentation. This block is used to detect if
|
113
113
|
# target library is present on the system. Typically this will involve
|
114
114
|
# checking to see if the target gem spec was loaded or if expected
|
115
115
|
# constants from the target library are present.
|
116
116
|
#
|
117
|
-
# @param [Callable] blk The present block for this
|
117
|
+
# @param [Callable] blk The present block for this instrumentation
|
118
118
|
def present(&blk)
|
119
119
|
@present_blk = blk
|
120
120
|
end
|
121
121
|
|
122
|
-
# The compatible block for this
|
122
|
+
# The compatible block for this instrumentation. This check will be run if the
|
123
123
|
# target library is present to determine if it's compatible. It's not
|
124
124
|
# required, but a common use case will be to check to target library
|
125
125
|
# version for compatibility.
|
126
126
|
#
|
127
|
-
# @param [Callable] blk The compatibility block for this
|
127
|
+
# @param [Callable] blk The compatibility block for this instrumentation
|
128
128
|
def compatible(&blk)
|
129
129
|
@compatible_blk = blk
|
130
130
|
end
|
131
131
|
|
132
132
|
def instance
|
133
|
-
@instance ||= new(
|
133
|
+
@instance ||= new(instrumentation_name, instrumentation_version, install_blk,
|
134
134
|
present_blk, compatible_blk)
|
135
135
|
end
|
136
136
|
|
@@ -171,11 +171,11 @@ module OpenTelemetry
|
|
171
171
|
@installed = false
|
172
172
|
end
|
173
173
|
|
174
|
-
# Install
|
174
|
+
# Install instrumentation with the given config. The present? and compatible?
|
175
175
|
# will be run first, and install will return false if either fail. Will
|
176
176
|
# return true if install was completed successfully.
|
177
177
|
#
|
178
|
-
# @param [Hash] config The config for this
|
178
|
+
# @param [Hash] config The config for this instrumentation
|
179
179
|
def install(config = {})
|
180
180
|
return true if installed?
|
181
181
|
return false unless installable?(config)
|
@@ -186,24 +186,24 @@ module OpenTelemetry
|
|
186
186
|
@installed = true
|
187
187
|
end
|
188
188
|
|
189
|
-
# Whether or not this
|
190
|
-
# be true when the
|
189
|
+
# Whether or not this instrumentation is installable in the current process. Will
|
190
|
+
# be true when the instrumentation defines an install block, is not disabled
|
191
191
|
# by environment or config, and the target library present and compatible.
|
192
192
|
#
|
193
|
-
# @param [Hash] config The config for this
|
193
|
+
# @param [Hash] config The config for this instrumentation
|
194
194
|
def installable?(config = {})
|
195
195
|
@install_blk && enabled?(config) && present? && compatible?
|
196
196
|
end
|
197
197
|
|
198
|
-
# Calls the present block of the
|
199
|
-
# it's assumed the
|
198
|
+
# Calls the present block of the Instrumentation subclasses, if no block is provided
|
199
|
+
# it's assumed the instrumentation is not present
|
200
200
|
def present?
|
201
201
|
return false unless @present_blk
|
202
202
|
|
203
203
|
instance_exec(&@present_blk)
|
204
204
|
end
|
205
205
|
|
206
|
-
# Calls the compatible block of the
|
206
|
+
# Calls the compatible block of the Instrumentation subclasses, if no block is provided
|
207
207
|
# it's assumed to be compatible
|
208
208
|
def compatible?
|
209
209
|
return true unless @compatible_blk
|
@@ -211,7 +211,7 @@ module OpenTelemetry
|
|
211
211
|
instance_exec(&@compatible_blk)
|
212
212
|
end
|
213
213
|
|
214
|
-
# Whether this
|
214
|
+
# Whether this instrumentation is enabled. It first checks to see if it's enabled
|
215
215
|
# by an environment variable and will proceed to check if it's enabled
|
216
216
|
# by local config, if given.
|
217
217
|
#
|
@@ -225,16 +225,17 @@ module OpenTelemetry
|
|
225
225
|
|
226
226
|
private
|
227
227
|
|
228
|
-
# Checks to see if this
|
229
|
-
# environment variable will be the
|
230
|
-
# replaced by underscores and _ENABLED appended.
|
231
|
-
# environment variable name for OpenTelemetry::
|
232
|
-
#
|
233
|
-
# the
|
228
|
+
# Checks to see if this instrumentation is enabled by env var. By convention, the
|
229
|
+
# environment variable will be the instrumentation name upper cased, with '::'
|
230
|
+
# replaced by underscores, OPENTELEMETRY shortened to OTEL_{LANG} and _ENABLED appended.
|
231
|
+
# For example, the, environment variable name for OpenTelemetry::Instrumentation::Sinatra
|
232
|
+
# will be OTEL_RUBY_INSTRUMENTATION_SINATRA_ENABLED. A value of 'false' will disable
|
233
|
+
# the instrumentation, all other values will enable it.
|
234
234
|
def enabled_by_env_var?
|
235
235
|
var_name = name.dup.tap do |n|
|
236
236
|
n.upcase!
|
237
237
|
n.gsub!('::', '_')
|
238
|
+
n.gsub!('OPENTELEMETRY_', 'OTEL_RUBY_')
|
238
239
|
n << '_ENABLED'
|
239
240
|
end
|
240
241
|
ENV[var_name] != 'false'
|
@@ -7,79 +7,79 @@
|
|
7
7
|
module OpenTelemetry
|
8
8
|
module Instrumentation
|
9
9
|
# The instrumentation Registry contains information about instrumentation
|
10
|
-
#
|
10
|
+
# available and facilitates discovery, installation and
|
11
11
|
# configuration. This functionality is primarily useful for SDK
|
12
12
|
# implementors.
|
13
13
|
class Registry
|
14
14
|
def initialize
|
15
15
|
@lock = Mutex.new
|
16
|
-
@
|
16
|
+
@instrumentation = []
|
17
17
|
end
|
18
18
|
|
19
19
|
# @api private
|
20
|
-
def register(
|
20
|
+
def register(instrumentation)
|
21
21
|
@lock.synchronize do
|
22
|
-
@
|
22
|
+
@instrumentation << instrumentation
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
# Lookup an
|
26
|
+
# Lookup an instrumentation definition by name. Returns nil if +instrumentation_name+
|
27
27
|
# is not found.
|
28
28
|
#
|
29
|
-
# @param [String]
|
30
|
-
# @return [
|
31
|
-
def lookup(
|
29
|
+
# @param [String] instrumentation_name A stringified class name for an instrumentation
|
30
|
+
# @return [Instrumentation]
|
31
|
+
def lookup(instrumentation_name)
|
32
32
|
@lock.synchronize do
|
33
|
-
|
33
|
+
find_instrumentation(instrumentation_name)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
# Install the specified
|
37
|
+
# Install the specified instrumentation with optionally specified configuration.
|
38
38
|
#
|
39
|
-
# @param [Array<String>]
|
39
|
+
# @param [Array<String>] instrumentation_names An array of instrumentation names to
|
40
40
|
# install
|
41
|
-
# @param [optional Hash<String, Hash>]
|
42
|
-
#
|
43
|
-
# passed for as many or as few
|
44
|
-
def install(
|
41
|
+
# @param [optional Hash<String, Hash>] instrumentation_config_map A map of
|
42
|
+
# instrumentation_name to config. This argument is optional and config can be
|
43
|
+
# passed for as many or as few instrumentations as desired.
|
44
|
+
def install(instrumentation_names, instrumentation_config_map = {})
|
45
45
|
@lock.synchronize do
|
46
|
-
|
47
|
-
|
48
|
-
OpenTelemetry.logger.warn "Could not install #{
|
46
|
+
instrumentation_names.each do |instrumentation_name|
|
47
|
+
instrumentation = find_instrumentation(instrumentation_name)
|
48
|
+
OpenTelemetry.logger.warn "Could not install #{instrumentation_name} because it was not found" unless instrumentation
|
49
49
|
|
50
|
-
|
50
|
+
install_instrumentation(instrumentation, instrumentation_config_map[instrumentation.name])
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
# Install all instrumentation available and installable in this process.
|
56
56
|
#
|
57
|
-
# @param [optional Hash<String, Hash>]
|
58
|
-
#
|
59
|
-
# passed for as many or as few
|
60
|
-
def install_all(
|
57
|
+
# @param [optional Hash<String, Hash>] instrumentation_config_map A map of
|
58
|
+
# instrumentation_name to config. This argument is optional and config can be
|
59
|
+
# passed for as many or as few instrumentations as desired.
|
60
|
+
def install_all(instrumentation_config_map = {})
|
61
61
|
@lock.synchronize do
|
62
|
-
@
|
63
|
-
|
62
|
+
@instrumentation.map(&:instance).each do |instrumentation|
|
63
|
+
install_instrumentation(instrumentation, instrumentation_config_map[instrumentation.name])
|
64
64
|
end
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
68
|
private
|
69
69
|
|
70
|
-
def
|
71
|
-
@
|
70
|
+
def find_instrumentation(instrumentation_name)
|
71
|
+
@instrumentation.detect { |a| a.instance.name == instrumentation_name }
|
72
72
|
&.instance
|
73
73
|
end
|
74
74
|
|
75
|
-
def
|
76
|
-
if
|
77
|
-
OpenTelemetry.logger.info "
|
75
|
+
def install_instrumentation(instrumentation, config)
|
76
|
+
if instrumentation.install(config)
|
77
|
+
OpenTelemetry.logger.info "Instrumentation: #{instrumentation.name} was successfully installed"
|
78
78
|
else
|
79
|
-
OpenTelemetry.logger.warn "
|
79
|
+
OpenTelemetry.logger.warn "Instrumentation: #{instrumentation.name} failed to install"
|
80
80
|
end
|
81
81
|
rescue => e # rubocop:disable Style/RescueStandardError
|
82
|
-
OpenTelemetry.logger.warn "
|
82
|
+
OpenTelemetry.logger.warn "Instrumentation: #{instrumentation.name} unhandled exception" \
|
83
83
|
"during install #{e}: #{e.backtrace}"
|
84
84
|
end
|
85
85
|
end
|
data/lib/opentelemetry/trace.rb
CHANGED
@@ -9,32 +9,30 @@ module OpenTelemetry
|
|
9
9
|
# single logical operation, consolidated across various components of an
|
10
10
|
# application.
|
11
11
|
module Trace
|
12
|
-
# An invalid trace identifier, a 16-byte
|
13
|
-
|
14
|
-
INVALID_TRACE_ID = ('0' * 32).freeze
|
12
|
+
# An invalid trace identifier, a 16-byte string with all zero bytes.
|
13
|
+
INVALID_TRACE_ID = ("\0" * 16).b
|
15
14
|
|
16
|
-
# An invalid span identifier, an 8-byte
|
17
|
-
|
18
|
-
INVALID_SPAN_ID = ('0' * 16).freeze
|
15
|
+
# An invalid span identifier, an 8-byte string with all zero bytes.
|
16
|
+
INVALID_SPAN_ID = ("\0" * 8).b
|
19
17
|
|
20
|
-
# Generates a valid trace identifier, a 16-byte
|
21
|
-
# non-zero byte
|
18
|
+
# Generates a valid trace identifier, a 16-byte string with at least one
|
19
|
+
# non-zero byte.
|
22
20
|
#
|
23
|
-
# @return [String] a
|
21
|
+
# @return [String] a valid trace ID.
|
24
22
|
def self.generate_trace_id
|
25
23
|
loop do
|
26
|
-
id = Random::DEFAULT.bytes(16)
|
24
|
+
id = Random::DEFAULT.bytes(16)
|
27
25
|
return id unless id == INVALID_TRACE_ID
|
28
26
|
end
|
29
27
|
end
|
30
28
|
|
31
|
-
# Generates a valid span identifier, an 8-byte
|
32
|
-
# non-zero byte
|
29
|
+
# Generates a valid span identifier, an 8-byte string with at least one
|
30
|
+
# non-zero byte.
|
33
31
|
#
|
34
|
-
# @return [String] a
|
32
|
+
# @return [String] a valid span ID.
|
35
33
|
def self.generate_span_id
|
36
34
|
loop do
|
37
|
-
id = Random::DEFAULT.bytes(8)
|
35
|
+
id = Random::DEFAULT.bytes(8)
|
38
36
|
return id unless id == INVALID_SPAN_ID
|
39
37
|
end
|
40
38
|
end
|
@@ -25,6 +25,10 @@ module OpenTelemetry
|
|
25
25
|
REGEXP = /^(?<version>[A-Fa-f0-9]{2})-(?<trace_id>[A-Fa-f0-9]{32})-(?<span_id>[A-Fa-f0-9]{16})-(?<flags>[A-Fa-f0-9]{2})(?<ignored>-.*)?$/.freeze
|
26
26
|
private_constant :REGEXP
|
27
27
|
|
28
|
+
INVALID_TRACE_ID = OpenTelemetry::Trace::INVALID_TRACE_ID.unpack1('H*')
|
29
|
+
INVALID_SPAN_ID = OpenTelemetry::Trace::INVALID_SPAN_ID.unpack1('H*')
|
30
|
+
private_constant :INVALID_TRACE_ID, :INVALID_SPAN_ID
|
31
|
+
|
28
32
|
class << self
|
29
33
|
# Creates a new {TraceParent} from a supplied {Trace::SpanContext}
|
30
34
|
# @param [SpanContext] ctx The context
|
@@ -71,17 +75,17 @@ module OpenTelemetry
|
|
71
75
|
end
|
72
76
|
|
73
77
|
def parse_trace_id(string)
|
74
|
-
raise InvalidTraceIDError, string if string ==
|
78
|
+
raise InvalidTraceIDError, string if string == INVALID_TRACE_ID
|
75
79
|
|
76
80
|
string.downcase!
|
77
|
-
string
|
81
|
+
Array(string).pack('H*')
|
78
82
|
end
|
79
83
|
|
80
84
|
def parse_span_id(string)
|
81
|
-
raise InvalidSpanIDError, string if string ==
|
85
|
+
raise InvalidSpanIDError, string if string == INVALID_SPAN_ID
|
82
86
|
|
83
87
|
string.downcase!
|
84
|
-
string
|
88
|
+
Array(string).pack('H*')
|
85
89
|
end
|
86
90
|
|
87
91
|
def parse_flags(string)
|
@@ -102,7 +106,7 @@ module OpenTelemetry
|
|
102
106
|
# converts this object into a string according to the w3c spec
|
103
107
|
# @return [String] the serialized trace_parent
|
104
108
|
def to_s
|
105
|
-
"00-#{trace_id}-#{span_id}-#{flag_string}"
|
109
|
+
"00-#{trace_id.unpack1('H*')}-#{span_id.unpack1('H*')}-#{flag_string}"
|
106
110
|
end
|
107
111
|
|
108
112
|
private
|
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: 0.
|
4
|
+
version: 0.5.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: 2020-
|
11
|
+
date: 2020-07-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark-ipsa
|
@@ -168,7 +168,7 @@ files:
|
|
168
168
|
- lib/opentelemetry/correlation_context/propagation/text_injector.rb
|
169
169
|
- lib/opentelemetry/error.rb
|
170
170
|
- lib/opentelemetry/instrumentation.rb
|
171
|
-
- lib/opentelemetry/instrumentation/
|
171
|
+
- lib/opentelemetry/instrumentation/base.rb
|
172
172
|
- lib/opentelemetry/instrumentation/registry.rb
|
173
173
|
- lib/opentelemetry/internal.rb
|
174
174
|
- lib/opentelemetry/metrics.rb
|