opentelemetry-instrumentation-base 0.20.0 → 0.21.1
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: 68289a48e73f4b932c2bfec1ec6c41bd2762dd6c7a8801bd58f1f84307857335
|
4
|
+
data.tar.gz: f7897e296091d94828653e0696ab5321e3ee63f355e082228a0d608b34ab5494
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f49d6aa1665d9452a390d160df35b3d004e221621284aac29662d9b8c8d01c22a96fed65ccc4d15fd2d6a344afa68729c345a31ce98f0fcc7459f77157624a3
|
7
|
+
data.tar.gz: a18559b8b4ae2fb1d9ef12d132f2268089139594ac6c6f9e2326174b3930812307347e5961a051d4e7a6470ee54043847344850e9e12c3d1d4a0c6ef501a7cef
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-base
|
2
2
|
|
3
|
+
### v0.21.1 / 2023-01-14
|
4
|
+
|
5
|
+
* DOCS: Fix gem homepage
|
6
|
+
* DOCS: More gem documentation fixes
|
7
|
+
|
8
|
+
### v0.21.0 / 2022-05-26
|
9
|
+
|
10
|
+
* BREAKING CHANGE: This requires upgrading both the SDK and Instrumentation gem in tandem
|
11
|
+
|
12
|
+
|
3
13
|
### v0.20.0 / 2022-05-02
|
4
14
|
|
5
15
|
* ADDED: Validate Using Enums
|
data/README.md
CHANGED
@@ -148,7 +148,7 @@ The `opentelemetry-instrumentation-base` gem is distributed under the Apache 2.0
|
|
148
148
|
|
149
149
|
[bundler-home]: https://bundler.io
|
150
150
|
[repo-github]: https://github.com/open-telemetry/opentelemetry-ruby
|
151
|
-
[license-github]: https://github.com/open-telemetry/opentelemetry-ruby/blob/main/LICENSE
|
151
|
+
[license-github]: https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/LICENSE
|
152
152
|
[ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
|
153
153
|
[community-meetings]: https://github.com/open-telemetry/community#community-meetings
|
154
154
|
[discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
|
@@ -72,9 +72,9 @@ module OpenTelemetry
|
|
72
72
|
|
73
73
|
private_constant :NAME_REGEX, :VALIDATORS
|
74
74
|
|
75
|
-
private :new
|
75
|
+
private :new
|
76
76
|
|
77
|
-
def inherited(subclass)
|
77
|
+
def inherited(subclass) # rubocop:disable Lint/MissingSuper
|
78
78
|
OpenTelemetry::Instrumentation.registry.register(subclass)
|
79
79
|
end
|
80
80
|
|
@@ -193,6 +193,7 @@ module OpenTelemetry
|
|
193
193
|
|
194
194
|
alias installed? installed
|
195
195
|
|
196
|
+
# rubocop:disable Metrics/ParameterLists
|
196
197
|
def initialize(name, version, install_blk, present_blk,
|
197
198
|
compatible_blk, options)
|
198
199
|
@name = name
|
@@ -205,6 +206,7 @@ module OpenTelemetry
|
|
205
206
|
@options = options
|
206
207
|
@tracer = OpenTelemetry::Trace::Tracer.new
|
207
208
|
end
|
209
|
+
# rubocop:enable Metrics/ParameterLists
|
208
210
|
|
209
211
|
# Install instrumentation with the given config. The present? and compatible?
|
210
212
|
# will be run first, and install will return false if either fail. Will
|
@@ -266,7 +268,7 @@ module OpenTelemetry
|
|
266
268
|
# Invalid configuration values are logged, and replaced by the default.
|
267
269
|
#
|
268
270
|
# @param [Hash] user_config The user supplied configuration hash
|
269
|
-
def config_options(user_config) # rubocop:disable Metrics/
|
271
|
+
def config_options(user_config) # rubocop:disable Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
270
272
|
@options ||= {}
|
271
273
|
user_config ||= {}
|
272
274
|
config_overrides = config_overrides_from_env
|
@@ -275,6 +277,7 @@ module OpenTelemetry
|
|
275
277
|
config_value = user_config[option_name]
|
276
278
|
config_override = coerce_env_var(config_overrides[option_name], option[:validation_type]) if config_overrides[option_name]
|
277
279
|
|
280
|
+
# rubocop:disable Lint/DuplicateBranch
|
278
281
|
value = if config_value.nil? && config_override.nil?
|
279
282
|
option[:default]
|
280
283
|
elsif option[:validator].respond_to?(:include?) && option[:validator].include?(config_override)
|
@@ -292,6 +295,7 @@ module OpenTelemetry
|
|
292
295
|
)
|
293
296
|
option[:default]
|
294
297
|
end
|
298
|
+
# rubocop:enable Lint/DuplicateBranch
|
295
299
|
|
296
300
|
h[option_name] = value
|
297
301
|
rescue StandardError => e
|
@@ -5,19 +5,12 @@
|
|
5
5
|
# SPDX-License-Identifier: Apache-2.0
|
6
6
|
|
7
7
|
require 'opentelemetry'
|
8
|
-
require 'opentelemetry
|
8
|
+
require 'opentelemetry-registry'
|
9
9
|
require 'opentelemetry/instrumentation/base'
|
10
10
|
|
11
11
|
module OpenTelemetry
|
12
12
|
# The instrumentation module contains functionality to register and install
|
13
13
|
# instrumentation
|
14
14
|
module Instrumentation
|
15
|
-
extend self
|
16
|
-
|
17
|
-
# @return [Registry] registry containing all known
|
18
|
-
# instrumentation
|
19
|
-
def registry
|
20
|
-
@registry ||= Registry.new
|
21
|
-
end
|
22
15
|
end
|
23
16
|
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.21.1
|
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: 2023-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -24,20 +24,34 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: opentelemetry-registry
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.1'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- - "
|
45
|
+
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
47
|
+
version: '2.4'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- - "
|
52
|
+
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
54
|
+
version: '2.4'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: minitest
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,28 +86,28 @@ dependencies:
|
|
72
86
|
requirements:
|
73
87
|
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
89
|
+
version: '13.0'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
96
|
+
version: '13.0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: rubocop
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
103
|
+
version: 1.41.1
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
110
|
+
version: 1.41.1
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: simplecov
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,16 +164,15 @@ files:
|
|
150
164
|
- lib/opentelemetry-instrumentation-base.rb
|
151
165
|
- lib/opentelemetry/instrumentation.rb
|
152
166
|
- lib/opentelemetry/instrumentation/base.rb
|
153
|
-
- lib/opentelemetry/instrumentation/registry.rb
|
154
167
|
- lib/opentelemetry/instrumentation/version.rb
|
155
|
-
homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
168
|
+
homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
|
156
169
|
licenses:
|
157
170
|
- Apache-2.0
|
158
171
|
metadata:
|
159
|
-
changelog_uri: https://
|
160
|
-
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/instrumentation/base
|
161
|
-
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
162
|
-
documentation_uri: https://
|
172
|
+
changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-base/0.21.1/file/CHANGELOG.md
|
173
|
+
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/base
|
174
|
+
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
|
175
|
+
documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-base/0.21.1
|
163
176
|
post_install_message:
|
164
177
|
rdoc_options: []
|
165
178
|
require_paths:
|
@@ -168,7 +181,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
168
181
|
requirements:
|
169
182
|
- - ">="
|
170
183
|
- !ruby/object:Gem::Version
|
171
|
-
version: 2.
|
184
|
+
version: 2.6.0
|
172
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
186
|
requirements:
|
174
187
|
- - ">="
|
@@ -1,88 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright The OpenTelemetry Authors
|
4
|
-
#
|
5
|
-
# SPDX-License-Identifier: Apache-2.0
|
6
|
-
|
7
|
-
module OpenTelemetry
|
8
|
-
module Instrumentation
|
9
|
-
# The instrumentation Registry contains information about instrumentation
|
10
|
-
# available and facilitates discovery, installation and
|
11
|
-
# configuration. This functionality is primarily useful for SDK
|
12
|
-
# implementors.
|
13
|
-
class Registry
|
14
|
-
def initialize
|
15
|
-
@lock = Mutex.new
|
16
|
-
@instrumentation = []
|
17
|
-
end
|
18
|
-
|
19
|
-
# @api private
|
20
|
-
def register(instrumentation)
|
21
|
-
@lock.synchronize do
|
22
|
-
@instrumentation << instrumentation
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
# Lookup an instrumentation definition by name. Returns nil if +instrumentation_name+
|
27
|
-
# is not found.
|
28
|
-
#
|
29
|
-
# @param [String] instrumentation_name A stringified class name for an instrumentation
|
30
|
-
# @return [Instrumentation]
|
31
|
-
def lookup(instrumentation_name)
|
32
|
-
@lock.synchronize do
|
33
|
-
find_instrumentation(instrumentation_name)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
# Install the specified instrumentation with optionally specified configuration.
|
38
|
-
#
|
39
|
-
# @param [Array<String>] instrumentation_names An array of instrumentation names to
|
40
|
-
# 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
|
-
@lock.synchronize do
|
46
|
-
instrumentation_names.each do |instrumentation_name|
|
47
|
-
instrumentation = find_instrumentation(instrumentation_name)
|
48
|
-
if instrumentation.nil?
|
49
|
-
OpenTelemetry.logger.warn "Could not install #{instrumentation_name} because it was not found"
|
50
|
-
else
|
51
|
-
install_instrumentation(instrumentation, instrumentation_config_map[instrumentation.name])
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
# Install all instrumentation available and installable in this process.
|
58
|
-
#
|
59
|
-
# @param [optional Hash<String, Hash>] instrumentation_config_map A map of
|
60
|
-
# instrumentation_name to config. This argument is optional and config can be
|
61
|
-
# passed for as many or as few instrumentations as desired.
|
62
|
-
def install_all(instrumentation_config_map = {})
|
63
|
-
@lock.synchronize do
|
64
|
-
@instrumentation.map(&:instance).each do |instrumentation|
|
65
|
-
install_instrumentation(instrumentation, instrumentation_config_map[instrumentation.name])
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
private
|
71
|
-
|
72
|
-
def find_instrumentation(instrumentation_name)
|
73
|
-
@instrumentation.detect { |a| a.instance.name == instrumentation_name }
|
74
|
-
&.instance
|
75
|
-
end
|
76
|
-
|
77
|
-
def install_instrumentation(instrumentation, config)
|
78
|
-
if instrumentation.install(config)
|
79
|
-
OpenTelemetry.logger.info "Instrumentation: #{instrumentation.name} was successfully installed with the following options #{instrumentation.config}"
|
80
|
-
else
|
81
|
-
OpenTelemetry.logger.warn "Instrumentation: #{instrumentation.name} failed to install"
|
82
|
-
end
|
83
|
-
rescue => e # rubocop:disable Style/RescueStandardError
|
84
|
-
OpenTelemetry.handle_error(exception: e, message: "Instrumentation: #{instrumentation.name} unhandled exception during install: #{e.backtrace}")
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|