opentelemetry-instrumentation-rails 0.17.0 → 0.19.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 +4 -4
- data/CHANGELOG.md +31 -8
- 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: 9271273081a8a5583bb56e4f4ee781c55bed1ad2b4be4253ab1c0ccc215bddb7
|
4
|
+
data.tar.gz: cfd66986f1e528027900893af155d781a86ff2be5afc2367126dc73cd3d121c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74c5ded807e64df1319c892772c0f5f83a91c1568a7e0c9f9da6e52e88ab07b9b97e070d7076a461bbc11f8b6ea2d28ac2d8847b60ba2a7c0aa4937189182bea
|
7
|
+
data.tar.gz: 68f3f69014b5b07023970fc5caff33a41011dbbab3ce2b83e4b5b6385383d58e9b702c4c9fc65b6b803e1c0b6353ea52abf72ca82e6b8a436a9b362aa2fd22a8
|
data/CHANGELOG.md
CHANGED
@@ -1,15 +1,38 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-rails
|
2
2
|
|
3
|
-
### v0.
|
3
|
+
### v0.19.1 / 2021-09-09
|
4
|
+
|
5
|
+
* (No significant changes)
|
6
|
+
|
7
|
+
### v0.19.0 / 2021-08-12
|
8
|
+
|
9
|
+
* ADDED: Instrument active record
|
10
|
+
* ADDED: Add ActionView instrumentation via ActiveSupport::Notifications
|
11
|
+
* FIXED: Rails instrumentation to not explicitly install sub gems
|
12
|
+
* DOCS: Update docs to rely more on environment variable configuration
|
13
|
+
|
14
|
+
* This release adds support for Active Record and Action View.
|
15
|
+
* The `enable_recognize_route` configuration option has been moved to the ActionPack gem.
|
16
|
+
* See readme for details on how to configure the sub instrumentation gems.
|
17
|
+
|
18
|
+
### v0.18.1 / 2021-06-23
|
4
19
|
|
5
|
-
* ADDED: Added http.route in rails instrumentation to match the spec
|
6
|
-
* FIXED: Rails example by not using `rails` from git
|
7
20
|
* FIXED: Updated rack middleware position to zero
|
8
21
|
|
22
|
+
### v0.18.0 / 2021-05-21
|
23
|
+
|
24
|
+
* ADDED: Updated API depedency for 1.0.0.rc1
|
25
|
+
|
26
|
+
### v0.17.0 / 2021-04-22
|
27
|
+
|
28
|
+
* ADDED: Added http.route in rails instrumentation to match the spec
|
29
|
+
* FIXED: Rails example by not using `rails` from git
|
30
|
+
* FIXED: Updated rack middleware position to zero
|
31
|
+
|
9
32
|
### v0.16.0 / 2021-03-17
|
10
33
|
|
11
|
-
* FIXED: Example scripts now reference local common lib
|
12
|
-
* DOCS: Replace Gitter with GitHub Discussions
|
34
|
+
* FIXED: Example scripts now reference local common lib
|
35
|
+
* DOCS: Replace Gitter with GitHub Discussions
|
13
36
|
|
14
37
|
### v0.15.0 / 2021-02-18
|
15
38
|
|
@@ -29,12 +52,12 @@
|
|
29
52
|
|
30
53
|
### v0.11.0 / 2020-12-11
|
31
54
|
|
32
|
-
* FIXED: Rails tests
|
33
|
-
* FIXED: Copyright comments to not reference year
|
55
|
+
* FIXED: Rails tests
|
56
|
+
* FIXED: Copyright comments to not reference year
|
34
57
|
|
35
58
|
### v0.10.0 / 2020-12-03
|
36
59
|
|
37
|
-
* FIXED: Otel-instrumentation-all not installing all
|
60
|
+
* FIXED: Otel-instrumentation-all not installing all
|
38
61
|
|
39
62
|
### v0.9.0 / 2020-11-27
|
40
63
|
|
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.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: 2021-
|
11
|
+
date: 2021-09-09 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: 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.
|
26
|
+
version: 1.0.0.rc3
|
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.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
|
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.2
|
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.2
|
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:
|
131
|
+
version: 1.0.0.rc1
|
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:
|
138
|
+
version: 1.0.0.rc1
|
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_after(
|
18
|
-
0,
|
19
|
-
OpenTelemetry::Instrumentation::Rack::Middlewares::TracerMiddleware
|
20
|
-
)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|