opentelemetry-instrumentation-rails 0.16.0 → 0.19.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: 5a83b6b54690f4740106e4fbb6a1d6eeb0f6e392adeaae14360e1f4b1ca260a6
4
- data.tar.gz: 8c0782fce816758e3ac2bdf162b11f61f9b31fe44992622e4333fee0d136c49e
3
+ metadata.gz: 83e599f0c6dd74b03a1ba2351634df27b41830de3d5c7a98d7978e937736cf04
4
+ data.tar.gz: b4f033ba3bf54a043dc592c95377678c630b08bd5b1a62598fc3e04f41139fdd
5
5
  SHA512:
6
- metadata.gz: e2df0ba03c759f251b870d9365928ce24584095eb0f9d467a8fa11f8227e38bcfbfc0b242c82af23af00b73227f69ac237d047615df0b1f2b92689a058d624e2
7
- data.tar.gz: 850eb20a873d9c9df90dbfab9775e45a710836ea58c6cf8525bbe3cb6b0456f47e1ed87c334142d0681ecc7b69e6331a73b544ef41eb92900ca072f615beffee
6
+ metadata.gz: 327efc6f764d24ab8d239e494344b4c85d7e1376fafa378a90e8171ccb104e821a4b0400c5a13de542e25a858357829dfad9a812e1965e2ba8c5b6f1ebfbb020
7
+ data.tar.gz: b9d58fb62cc0adb707dd3477af5dba12051dab2bc83cf43deeb1eee5ff29f8037fd1e963873a4d6a142c12ce5f45a06a465c6f7dbd86eeb9465500f633294a67
data/CHANGELOG.md CHANGED
@@ -1,9 +1,34 @@
1
1
  # Release History: opentelemetry-instrumentation-rails
2
2
 
3
+ ### v0.19.0 / 2021-08-12
4
+
5
+ * ADDED: Instrument active record
6
+ * ADDED: Add ActionView instrumentation via ActiveSupport::Notifications
7
+ * FIXED: Rails instrumentation to not explicitly install sub gems
8
+ * DOCS: Update docs to rely more on environment variable configuration
9
+
10
+ * This release adds support for Active Record and Action View.
11
+ * The `enable_recognize_route` configuration option has been moved to the ActionPack gem.
12
+ * See readme for details on how to configure the sub instrumentation gems.
13
+
14
+ ### v0.18.1 / 2021-06-23
15
+
16
+ * FIXED: Updated rack middleware position to zero
17
+
18
+ ### v0.18.0 / 2021-05-21
19
+
20
+ * ADDED: Updated API depedency for 1.0.0.rc1
21
+
22
+ ### v0.17.0 / 2021-04-22
23
+
24
+ * ADDED: Added http.route in rails instrumentation to match the spec
25
+ * FIXED: Rails example by not using `rails` from git
26
+ * FIXED: Updated rack middleware position to zero
27
+
3
28
  ### v0.16.0 / 2021-03-17
4
29
 
5
- * FIXED: Example scripts now reference local common lib
6
- * DOCS: Replace Gitter with GitHub Discussions
30
+ * FIXED: Example scripts now reference local common lib
31
+ * DOCS: Replace Gitter with GitHub Discussions
7
32
 
8
33
  ### v0.15.0 / 2021-02-18
9
34
 
@@ -23,12 +48,12 @@
23
48
 
24
49
  ### v0.11.0 / 2020-12-11
25
50
 
26
- * FIXED: Rails tests
27
- * FIXED: Copyright comments to not reference year
51
+ * FIXED: Rails tests
52
+ * FIXED: Copyright comments to not reference year
28
53
 
29
54
  ### v0.10.0 / 2020-12-03
30
55
 
31
- * FIXED: Otel-instrumentation-all not installing all
56
+ * FIXED: Otel-instrumentation-all not installing all
32
57
 
33
58
  ### v0.9.0 / 2020-11-27
34
59
 
data/README.md CHANGED
@@ -14,19 +14,22 @@ Or, if you use [bundler][bundler-home], include `opentelemetry-instrumentation-r
14
14
 
15
15
  ## Usage
16
16
 
17
- To use the instrumentation, call `use` with the name of the instrumentation:
17
+ To use the Rails instrumentation, call `use_all` so it installs all the instrumentation gems.
18
18
 
19
19
  ```ruby
20
20
  OpenTelemetry::SDK.configure do |c|
21
- c.use 'OpenTelemetry::Instrumentation::Rails'
21
+ c.use_all
22
22
  end
23
23
  ```
24
24
 
25
- Alternatively, you can also call `use_all` to install all the available instrumentation.
25
+ ### Configuration options
26
+
27
+ The Rails instrumentation attempts to mirror the structure of the Ruby on Rails. It is a collection of instrumentation gems for components of Rails such as Action View, Active Record, Action Pack, etc...
26
28
 
29
+ You may want to include all of the Rails instrumentation but disable a single instrumentation gem that it includes. Here is an example of how you can disable Active Record when using this instrumentation gem.
27
30
  ```ruby
28
31
  OpenTelemetry::SDK.configure do |c|
29
- c.use_all
32
+ c.use_all({ 'OpenTelemetry::Instrumentation::ActiveRecord' => { enabled: false } })
30
33
  end
31
34
  ```
32
35
 
@@ -5,6 +5,7 @@
5
5
  # SPDX-License-Identifier: Apache-2.0
6
6
 
7
7
  require 'opentelemetry'
8
+ require 'opentelemetry-instrumentation-base'
8
9
 
9
10
  module OpenTelemetry
10
11
  module Instrumentation
@@ -14,6 +15,8 @@ module OpenTelemetry
14
15
  end
15
16
  end
16
17
 
17
- require 'opentelemetry-instrumentation-rack'
18
+ require 'opentelemetry-instrumentation-action_pack'
19
+ require 'opentelemetry-instrumentation-action_view'
20
+ require 'opentelemetry-instrumentation-active_record'
18
21
  require_relative './rails/instrumentation'
19
22
  require_relative './rails/version'
@@ -12,28 +12,19 @@ module OpenTelemetry
12
12
  # The Instrumentation class contains logic to detect and install the Rails
13
13
  # instrumentation
14
14
  class Instrumentation < OpenTelemetry::Instrumentation::Base
15
- install do |_config|
16
- require_dependencies
17
- require_railtie
18
- patch_metal
19
- end
15
+ MINIMUM_VERSION = Gem::Version.new('5.2.0')
20
16
 
21
- present do
22
- defined?(::Rails)
23
- end
17
+ # This gem requires the instrumentantion gems for the different
18
+ # components of Rails, as a result it does not have any explicit
19
+ # work to do in the install step.
20
+ install { true }
21
+ present { defined?(::Rails) }
22
+ compatible { gem_version >= MINIMUM_VERSION }
24
23
 
25
24
  private
26
25
 
27
- def require_dependencies
28
- require_relative 'patches/action_controller/metal'
29
- end
30
-
31
- def require_railtie
32
- require_relative 'railtie'
33
- end
34
-
35
- def patch_metal
36
- ::ActionController::Metal.prepend(Patches::ActionController::Metal)
26
+ def gem_version
27
+ Gem.loaded_specs['actionpack'].version
37
28
  end
38
29
  end
39
30
  end
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module Rails
10
- VERSION = '0.16.0'
10
+ VERSION = '0.19.0'
11
11
  end
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-instrumentation-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.19.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: 2021-03-22 00:00:00.000000000 Z
11
+ date: 2021-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -16,28 +16,70 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.16.0
19
+ version: 1.0.0.rc3
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: 0.16.0
26
+ version: 1.0.0.rc3
27
27
  - !ruby/object:Gem::Dependency
28
- name: opentelemetry-instrumentation-rack
28
+ name: opentelemetry-instrumentation-action_pack
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.16.0
33
+ version: 0.1.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.16.0
40
+ version: 0.1.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: opentelemetry-instrumentation-action_view
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.1.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.1.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: opentelemetry-instrumentation-active_record
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.1.1
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.1.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: opentelemetry-instrumentation-base
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.18.2
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.18.2
41
83
  - !ruby/object:Gem::Dependency
42
84
  name: appraisal
43
85
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +128,14 @@ dependencies:
86
128
  requirements:
87
129
  - - "~>"
88
130
  - !ruby/object:Gem::Version
89
- version: '0.0'
131
+ version: 1.0.0.rc1
90
132
  type: :development
91
133
  prerelease: false
92
134
  version_requirements: !ruby/object:Gem::Requirement
93
135
  requirements:
94
136
  - - "~>"
95
137
  - !ruby/object:Gem::Version
96
- version: '0.0'
138
+ version: 1.0.0.rc1
97
139
  - !ruby/object:Gem::Dependency
98
140
  name: rack-test
99
141
  requirement: !ruby/object:Gem::Requirement
@@ -221,8 +263,6 @@ files:
221
263
  - lib/opentelemetry/instrumentation.rb
222
264
  - lib/opentelemetry/instrumentation/rails.rb
223
265
  - lib/opentelemetry/instrumentation/rails/instrumentation.rb
224
- - lib/opentelemetry/instrumentation/rails/patches/action_controller/metal.rb
225
- - lib/opentelemetry/instrumentation/rails/railtie.rb
226
266
  - lib/opentelemetry/instrumentation/rails/version.rb
227
267
  homepage: https://github.com/open-telemetry/opentelemetry-ruby
228
268
  licenses:
@@ -244,7 +284,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
284
  - !ruby/object:Gem::Version
245
285
  version: '0'
246
286
  requirements: []
247
- rubygems_version: 3.1.4
287
+ rubygems_version: 3.1.6
248
288
  signing_key:
249
289
  specification_version: 4
250
290
  summary: Rails instrumentation for the OpenTelemetry framework
@@ -1,24 +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
- module Rails
10
- module Patches
11
- module ActionController
12
- # Module to prepend to ActionController::Metal for instrumentation
13
- module Metal
14
- def dispatch(name, request, response)
15
- rack_span = OpenTelemetry::Instrumentation::Rack.current_span
16
- rack_span.name = "#{self.class.name}##{name}" if rack_span.context.valid? && !request.env['action_dispatch.exception']
17
- super(name, request, response)
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,25 +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
- module Rails
10
- # The Instrumentation class contains logic to detect and install the Rails
11
- # instrumentation, while this Railtie is used to conventionally instrument
12
- # the Rails application through its initialization hooks
13
- class Railtie < ::Rails::Railtie
14
- config.before_initialize do |app|
15
- OpenTelemetry::Instrumentation::Rack::Instrumentation.instance.install({})
16
-
17
- app.middleware.insert_after(
18
- ActionDispatch::RequestId,
19
- OpenTelemetry::Instrumentation::Rack::Middlewares::TracerMiddleware
20
- )
21
- end
22
- end
23
- end
24
- end
25
- end