opentelemetry-instrumentation-base 0.18.2 → 0.20.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36880f3027db5ce9434787fc96f373497e7e4a0986bba01db8936abd6a6c6f60
|
4
|
+
data.tar.gz: 2b6e9ef13f8ccad67f9c3d1138343192b4ea9df5fc0393acea2351b3bc498cf4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90af953fd300ccbf1dbde0381999279d3773d79a02297b97ad5148eb070ea6fab7cbcaf38b82f6f2f3b60e4256b49302f0f844e77cfecfcd7d9d4b11b05fe095
|
7
|
+
data.tar.gz: e58a221f4f846955c7d122b15766b2afba00007343ae54e8fa890346ad3d3ff56c08bdb9d297084ba0c84da6cd9152dba27b09e74850811737143181cd47c24f
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-base
|
2
2
|
|
3
|
+
### v0.20.0 / 2022-05-02
|
4
|
+
|
5
|
+
* ADDED: Validate Using Enums
|
6
|
+
* FIXED: RubyGems Fallback
|
7
|
+
|
8
|
+
### v0.19.0 / 2021-12-01
|
9
|
+
|
10
|
+
* ADDED: Add default options config helper + env var config option support
|
11
|
+
|
12
|
+
### v0.18.3 / 2021-09-29
|
13
|
+
|
14
|
+
* (No significant changes)
|
15
|
+
|
3
16
|
### v0.18.2 / 2021-08-12
|
4
17
|
|
5
18
|
* (No significant changes)
|
@@ -32,7 +32,7 @@ module OpenTelemetry
|
|
32
32
|
#
|
33
33
|
# # if the target library is present, is it compatible?
|
34
34
|
# compatible do
|
35
|
-
# Gem.
|
35
|
+
# Gem::Version.new(Sinatra::VERSION)) > MIN_VERSION
|
36
36
|
# end
|
37
37
|
# end
|
38
38
|
# end
|
@@ -146,11 +146,20 @@ module OpenTelemetry
|
|
146
146
|
# a key in the VALIDATORS hash. The supported keys are, :array, :boolean,
|
147
147
|
# :callable, :integer, :string.
|
148
148
|
def option(name, default:, validate:)
|
149
|
-
|
150
|
-
raise ArgumentError, "validate must be #{VALIDATORS.keys.join(', ')}, or a callable" unless
|
149
|
+
validator = VALIDATORS[validate] || validate
|
150
|
+
raise ArgumentError, "validate must be #{VALIDATORS.keys.join(', ')}, or a callable" unless validator.respond_to?(:call) || validator.respond_to?(:include?)
|
151
151
|
|
152
152
|
@options ||= []
|
153
|
-
|
153
|
+
|
154
|
+
validation_type = if VALIDATORS[validate]
|
155
|
+
validate
|
156
|
+
elsif validate.respond_to?(:include?)
|
157
|
+
:enum
|
158
|
+
else
|
159
|
+
:callable
|
160
|
+
end
|
161
|
+
|
162
|
+
@options << { name: name, default: default, validator: validator, validation_type: validation_type }
|
154
163
|
end
|
155
164
|
|
156
165
|
def instance
|
@@ -257,16 +266,24 @@ module OpenTelemetry
|
|
257
266
|
# Invalid configuration values are logged, and replaced by the default.
|
258
267
|
#
|
259
268
|
# @param [Hash] user_config The user supplied configuration hash
|
260
|
-
def config_options(user_config) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
269
|
+
def config_options(user_config) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
261
270
|
@options ||= {}
|
262
271
|
user_config ||= {}
|
272
|
+
config_overrides = config_overrides_from_env
|
263
273
|
validated_config = @options.each_with_object({}) do |option, h|
|
264
274
|
option_name = option[:name]
|
265
275
|
config_value = user_config[option_name]
|
276
|
+
config_override = coerce_env_var(config_overrides[option_name], option[:validation_type]) if config_overrides[option_name]
|
266
277
|
|
267
|
-
value = if config_value.nil?
|
278
|
+
value = if config_value.nil? && config_override.nil?
|
268
279
|
option[:default]
|
269
|
-
elsif option[:
|
280
|
+
elsif option[:validator].respond_to?(:include?) && option[:validator].include?(config_override)
|
281
|
+
config_override
|
282
|
+
elsif option[:validator].respond_to?(:include?) && option[:validator].include?(config_value)
|
283
|
+
config_value
|
284
|
+
elsif option[:validator].respond_to?(:call) && option[:validator].call(config_override)
|
285
|
+
config_override
|
286
|
+
elsif option[:validator].respond_to?(:call) && option[:validator].call(config_value)
|
270
287
|
config_value
|
271
288
|
else
|
272
289
|
OpenTelemetry.logger.warn(
|
@@ -303,6 +320,49 @@ module OpenTelemetry
|
|
303
320
|
end
|
304
321
|
ENV[var_name] != 'false'
|
305
322
|
end
|
323
|
+
|
324
|
+
def config_overrides_from_env
|
325
|
+
var_name = name.dup.tap do |n|
|
326
|
+
n.upcase!
|
327
|
+
n.gsub!('::', '_')
|
328
|
+
n.gsub!('OPENTELEMETRY_', 'OTEL_RUBY_')
|
329
|
+
n << '_CONFIG_OPTS'
|
330
|
+
end
|
331
|
+
|
332
|
+
environment_config_overrides = {}
|
333
|
+
env_config_options = ENV[var_name]&.split(';')
|
334
|
+
|
335
|
+
return environment_config_overrides if env_config_options.nil?
|
336
|
+
|
337
|
+
env_config_options.each_with_object(environment_config_overrides) do |env_config_option, eco|
|
338
|
+
parts = env_config_option.split('=')
|
339
|
+
option_name = parts[0].to_sym
|
340
|
+
eco[option_name] = parts[1]
|
341
|
+
end
|
342
|
+
|
343
|
+
environment_config_overrides
|
344
|
+
end
|
345
|
+
|
346
|
+
def coerce_env_var(env_var, validation_type) # rubocop:disable Metrics/CyclomaticComplexity
|
347
|
+
case validation_type
|
348
|
+
when :array
|
349
|
+
env_var.split(',').map(&:strip)
|
350
|
+
when :boolean
|
351
|
+
env_var.to_s.strip.downcase == 'true'
|
352
|
+
when :integer
|
353
|
+
env_var.to_i
|
354
|
+
when :string
|
355
|
+
env_var.to_s.strip
|
356
|
+
when :enum
|
357
|
+
env_var.to_s.strip.to_sym
|
358
|
+
when :callable
|
359
|
+
OpenTelemetry.logger.warn(
|
360
|
+
"Instrumentation #{name} options that accept a callable are not " \
|
361
|
+
"configurable using environment variables. Ignoring raw value: #{env_var}"
|
362
|
+
)
|
363
|
+
nil
|
364
|
+
end
|
365
|
+
end
|
306
366
|
end
|
307
367
|
end
|
308
368
|
end
|
@@ -76,7 +76,7 @@ module OpenTelemetry
|
|
76
76
|
|
77
77
|
def install_instrumentation(instrumentation, config)
|
78
78
|
if instrumentation.install(config)
|
79
|
-
OpenTelemetry.logger.info "Instrumentation: #{instrumentation.name} was successfully installed"
|
79
|
+
OpenTelemetry.logger.info "Instrumentation: #{instrumentation.name} was successfully installed with the following options #{instrumentation.config}"
|
80
80
|
else
|
81
81
|
OpenTelemetry.logger.warn "Instrumentation: #{instrumentation.name} failed to install"
|
82
82
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opentelemetry-instrumentation-base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.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:
|
11
|
+
date: 2022-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.0
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.0
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: opentelemetry-test-helpers
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rake
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,10 +156,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
|
142
156
|
licenses:
|
143
157
|
- Apache-2.0
|
144
158
|
metadata:
|
145
|
-
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-base/v0.
|
159
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-base/v0.20.0/file.CHANGELOG.html
|
146
160
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/instrumentation/base
|
147
161
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
148
|
-
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-base/v0.
|
162
|
+
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-base/v0.20.0
|
149
163
|
post_install_message:
|
150
164
|
rdoc_options: []
|
151
165
|
require_paths:
|