opentelemetry-instrumentation-rails 0.16.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +12 -0
- data/lib/opentelemetry/instrumentation/rails.rb +1 -0
- data/lib/opentelemetry/instrumentation/rails/instrumentation.rb +2 -0
- data/lib/opentelemetry/instrumentation/rails/patches/action_controller/metal.rb +14 -0
- data/lib/opentelemetry/instrumentation/rails/railtie.rb +1 -1
- data/lib/opentelemetry/instrumentation/rails/version.rb +1 -1
- metadata +21 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 689a1c682f6de7f70663955bdc99a1de4f758ff9d54cc14f9d18d1b5c3896b54
|
4
|
+
data.tar.gz: 43387df2aea22327d040971a3c500db575fcf100114835e8f2707f89e5289230
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9491e565317e410bfbb0c1dbab9b2b95a0320b68d5018b7aaf4d852f8dcf90a8a3e07e60c36d9fb83378673f14701e644b74456a7b4a0a866335eb1d7424cfd4
|
7
|
+
data.tar.gz: eba631a571aea18efa7aab46a4f39e06466be945ea3e28040fa0961f14265ab4aa80772b49a6cce75d38ec1414b83ede2d70b893fd4d9f545415bcb9b3edce1c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Release History: opentelemetry-instrumentation-rails
|
2
2
|
|
3
|
+
### v0.17.0 / 2021-04-22
|
4
|
+
|
5
|
+
* ADDED: Added http.route in rails instrumentation to match the spec
|
6
|
+
* FIXED: Rails example by not using `rails` from git
|
7
|
+
* FIXED: Updated rack middleware position to zero
|
8
|
+
|
3
9
|
### v0.16.0 / 2021-03-17
|
4
10
|
|
5
11
|
* FIXED: Example scripts now reference local common lib
|
data/README.md
CHANGED
@@ -30,6 +30,18 @@ OpenTelemetry::SDK.configure do |c|
|
|
30
30
|
end
|
31
31
|
```
|
32
32
|
|
33
|
+
|
34
|
+
### Configuration options
|
35
|
+
|
36
|
+
The `http.route` attribute is disabled by default because we use [.recognize](https://github.com/rails/rails/blob/v6.1.3/actionpack/lib/action_dispatch/journey/router.rb#L65)
|
37
|
+
```ruby
|
38
|
+
OpenTelemetry::SDK.configure do |c|
|
39
|
+
c.use 'OpenTelemetry::Instrumentation::Rails', {
|
40
|
+
enable_recognize_route: true
|
41
|
+
}
|
42
|
+
end
|
43
|
+
```
|
44
|
+
|
33
45
|
## Examples
|
34
46
|
|
35
47
|
Example usage can be seen in the `./example/trace_demonstration.rb` file [here](https://github.com/open-telemetry/opentelemetry-ruby/blob/main/instrumentation/rails/example/trace_request_demonstration.ru)
|
@@ -14,8 +14,22 @@ module OpenTelemetry
|
|
14
14
|
def dispatch(name, request, response)
|
15
15
|
rack_span = OpenTelemetry::Instrumentation::Rack.current_span
|
16
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]
|
17
19
|
super(name, request, response)
|
18
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
|
19
33
|
end
|
20
34
|
end
|
21
35
|
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.
|
4
|
+
version: 0.17.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-
|
11
|
+
date: 2021-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opentelemetry-api
|
@@ -16,28 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.17.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: 0.
|
26
|
+
version: 0.17.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: opentelemetry-instrumentation-base
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.17.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.17.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: opentelemetry-instrumentation-rack
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
47
|
+
version: 0.17.0
|
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.17.0
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: appraisal
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -244,7 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
244
258
|
- !ruby/object:Gem::Version
|
245
259
|
version: '0'
|
246
260
|
requirements: []
|
247
|
-
rubygems_version: 3.1.
|
261
|
+
rubygems_version: 3.1.6
|
248
262
|
signing_key:
|
249
263
|
specification_version: 4
|
250
264
|
summary: Rails instrumentation for the OpenTelemetry framework
|