opentelemetry-instrumentation-base 0.20.0 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99e6450e5fe0a34262181644384ac289093fb11dc924dcdb44be21e46715cddb
|
4
|
+
data.tar.gz: 91dcb93efdcabe5db3619fe0fb962f0512373759aafb34bcabee9ea31f1092c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4da44cb456ec692d62577aee339c9bcf3b1cd57aa49d5e6a8e96b0a6ab2da1f8b3b367a10f8593751b1caa4c163c257d9760b8842d94bc66839816828456c2c
|
7
|
+
data.tar.gz: 54de81f111d50c53305054975bd43e6dbb8bebe3386eed876dc7a36ed4f42ef5416c5668f25962b1427a911fbdcde7ea1c87892f5fcc9fdb9407f83c4e392a65
|
data/CHANGELOG.md
CHANGED
@@ -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.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-05-
|
11
|
+
date: 2022-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -24,6 +24,20 @@ 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
|
@@ -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
168
|
homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
156
169
|
licenses:
|
157
170
|
- Apache-2.0
|
158
171
|
metadata:
|
159
|
-
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-base/v0.
|
172
|
+
changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-base/v0.21.0/file.CHANGELOG.html
|
160
173
|
source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/instrumentation/base
|
161
174
|
bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
|
162
|
-
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-base/v0.
|
175
|
+
documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-base/v0.21.0
|
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
|