opentelemetry-instrumentation-rails 0.18.1 → 0.19.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/README.md +5 -14
- data/lib/opentelemetry/instrumentation/rails/instrumentation.rb +9 -20
- data/lib/opentelemetry/instrumentation/rails/version.rb +1 -1
- data/lib/opentelemetry/instrumentation/rails.rb +3 -1
- metadata +40 -14
- data/lib/opentelemetry/instrumentation/rails/patches/action_controller/metal.rb +0 -38
- data/lib/opentelemetry/instrumentation/rails/railtie.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 769115436d981715483ac62d78a7d2ce77e64f79546168b31e0fc3c8f9c33c0b
|
4
|
+
data.tar.gz: 18ea430a2df3e65a4d11450141b984d67b46101f1a30c9a7086c28ed0fb3ed60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b091af69e413cdcaddeb5f6110e5129358302b3e866d918716100ad9e1a4e8357b43d57ecb086bea5dacaf0f293e787ec48668470086f9ae5600ed20d32b4b04
|
7
|
+
data.tar.gz: 4d60f91002b49169f527a07fe31ebb30ca8b5e4077cbfcab0191b96122232bb729ce8004622e8a0e8a39ab10b815957791285bdf1b75413d57d23a2eb34ae549
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-rails
|
2
2
|
|
3
|
+
### v0.19.3 / 2021-09-29
|
4
|
+
|
5
|
+
* (No significant changes)
|
6
|
+
|
7
|
+
### v0.19.2 / 2021-09-29
|
8
|
+
|
9
|
+
* (No significant changes)
|
10
|
+
|
11
|
+
### v0.19.1 / 2021-09-09
|
12
|
+
|
13
|
+
* (No significant changes)
|
14
|
+
|
15
|
+
### v0.19.0 / 2021-08-12
|
16
|
+
|
17
|
+
* ADDED: Instrument active record
|
18
|
+
* ADDED: Add ActionView instrumentation via ActiveSupport::Notifications
|
19
|
+
* FIXED: Rails instrumentation to not explicitly install sub gems
|
20
|
+
* DOCS: Update docs to rely more on environment variable configuration
|
21
|
+
|
22
|
+
* This release adds support for Active Record and Action View.
|
23
|
+
* The `enable_recognize_route` configuration option has been moved to the ActionPack gem.
|
24
|
+
* See readme for details on how to configure the sub instrumentation gems.
|
25
|
+
|
3
26
|
### v0.18.1 / 2021-06-23
|
4
27
|
|
5
28
|
* FIXED: Updated rack middleware position to zero
|
data/README.md
CHANGED
@@ -14,15 +14,7 @@ Or, if you use [bundler][bundler-home], include `opentelemetry-instrumentation-r
|
|
14
14
|
|
15
15
|
## Usage
|
16
16
|
|
17
|
-
To use the instrumentation, call `
|
18
|
-
|
19
|
-
```ruby
|
20
|
-
OpenTelemetry::SDK.configure do |c|
|
21
|
-
c.use 'OpenTelemetry::Instrumentation::Rails'
|
22
|
-
end
|
23
|
-
```
|
24
|
-
|
25
|
-
Alternatively, you can also call `use_all` to install all the available instrumentation.
|
17
|
+
To use the Rails instrumentation, call `use_all` so it installs all the instrumentation gems.
|
26
18
|
|
27
19
|
```ruby
|
28
20
|
OpenTelemetry::SDK.configure do |c|
|
@@ -30,15 +22,14 @@ OpenTelemetry::SDK.configure do |c|
|
|
30
22
|
end
|
31
23
|
```
|
32
24
|
|
33
|
-
|
34
25
|
### Configuration options
|
35
26
|
|
36
|
-
The
|
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...
|
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.
|
37
30
|
```ruby
|
38
31
|
OpenTelemetry::SDK.configure do |c|
|
39
|
-
c.
|
40
|
-
enable_recognize_route: true
|
41
|
-
}
|
32
|
+
c.use_all({ 'OpenTelemetry::Instrumentation::ActiveRecord' => { enabled: false } })
|
42
33
|
end
|
43
34
|
```
|
44
35
|
|
@@ -12,30 +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
|
-
|
16
|
-
require_dependencies
|
17
|
-
require_railtie
|
18
|
-
patch_metal
|
19
|
-
end
|
20
|
-
|
21
|
-
present do
|
22
|
-
defined?(::Rails)
|
23
|
-
end
|
15
|
+
MINIMUM_VERSION = Gem::Version.new('5.2.0')
|
24
16
|
|
25
|
-
|
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 }
|
26
23
|
|
27
24
|
private
|
28
25
|
|
29
|
-
def
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
def require_railtie
|
34
|
-
require_relative 'railtie'
|
35
|
-
end
|
36
|
-
|
37
|
-
def patch_metal
|
38
|
-
::ActionController::Metal.prepend(Patches::ActionController::Metal)
|
26
|
+
def gem_version
|
27
|
+
Gem.loaded_specs['actionpack'].version
|
39
28
|
end
|
40
29
|
end
|
41
30
|
end
|
@@ -15,6 +15,8 @@ module OpenTelemetry
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
require 'opentelemetry-instrumentation-
|
18
|
+
require 'opentelemetry-instrumentation-action_pack'
|
19
|
+
require 'opentelemetry-instrumentation-action_view'
|
20
|
+
require 'opentelemetry-instrumentation-active_record'
|
19
21
|
require_relative './rails/instrumentation'
|
20
22
|
require_relative './rails/version'
|
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.
|
4
|
+
version: 0.19.3
|
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-
|
11
|
+
date: 2021-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -16,42 +16,70 @@ 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
|
-
name: opentelemetry-instrumentation-
|
28
|
+
name: opentelemetry-instrumentation-action_pack
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.1.0
|
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.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: opentelemetry-instrumentation-action_view
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
47
|
+
version: 0.1.1
|
34
48
|
type: :runtime
|
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: 0.
|
54
|
+
version: 0.1.1
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: opentelemetry-instrumentation-
|
56
|
+
name: opentelemetry-instrumentation-active_record
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.2.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.2.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: opentelemetry-instrumentation-base
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
44
72
|
requirements:
|
45
73
|
- - "~>"
|
46
74
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
75
|
+
version: 0.18.3
|
48
76
|
type: :runtime
|
49
77
|
prerelease: false
|
50
78
|
version_requirements: !ruby/object:Gem::Requirement
|
51
79
|
requirements:
|
52
80
|
- - "~>"
|
53
81
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
82
|
+
version: 0.18.3
|
55
83
|
- !ruby/object:Gem::Dependency
|
56
84
|
name: appraisal
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +128,14 @@ dependencies:
|
|
100
128
|
requirements:
|
101
129
|
- - "~>"
|
102
130
|
- !ruby/object:Gem::Version
|
103
|
-
version: 1.0
|
131
|
+
version: '1.0'
|
104
132
|
type: :development
|
105
133
|
prerelease: false
|
106
134
|
version_requirements: !ruby/object:Gem::Requirement
|
107
135
|
requirements:
|
108
136
|
- - "~>"
|
109
137
|
- !ruby/object:Gem::Version
|
110
|
-
version: 1.0
|
138
|
+
version: '1.0'
|
111
139
|
- !ruby/object:Gem::Dependency
|
112
140
|
name: rack-test
|
113
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -235,8 +263,6 @@ files:
|
|
235
263
|
- lib/opentelemetry/instrumentation.rb
|
236
264
|
- lib/opentelemetry/instrumentation/rails.rb
|
237
265
|
- lib/opentelemetry/instrumentation/rails/instrumentation.rb
|
238
|
-
- lib/opentelemetry/instrumentation/rails/patches/action_controller/metal.rb
|
239
|
-
- lib/opentelemetry/instrumentation/rails/railtie.rb
|
240
266
|
- lib/opentelemetry/instrumentation/rails/version.rb
|
241
267
|
homepage: https://github.com/open-telemetry/opentelemetry-ruby
|
242
268
|
licenses:
|
@@ -1,38 +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
|
-
|
18
|
-
add_rails_route(rack_span, request) if instrumentation_config[:enable_recognize_route]
|
19
|
-
super(name, request, response)
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def add_rails_route(rack_span, request)
|
25
|
-
::Rails.application.routes.router.recognize(request) do |route, _params|
|
26
|
-
rack_span.set_attribute('http.route', route.path.spec.to_s)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def instrumentation_config
|
31
|
-
Rails::Instrumentation.instance.config
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
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_before(
|
18
|
-
0,
|
19
|
-
OpenTelemetry::Instrumentation::Rack::Middlewares::TracerMiddleware
|
20
|
-
)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|