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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a83b6b54690f4740106e4fbb6a1d6eeb0f6e392adeaae14360e1f4b1ca260a6
4
- data.tar.gz: 8c0782fce816758e3ac2bdf162b11f61f9b31fe44992622e4333fee0d136c49e
3
+ metadata.gz: 689a1c682f6de7f70663955bdc99a1de4f758ff9d54cc14f9d18d1b5c3896b54
4
+ data.tar.gz: 43387df2aea22327d040971a3c500db575fcf100114835e8f2707f89e5289230
5
5
  SHA512:
6
- metadata.gz: e2df0ba03c759f251b870d9365928ce24584095eb0f9d467a8fa11f8227e38bcfbfc0b242c82af23af00b73227f69ac237d047615df0b1f2b92689a058d624e2
7
- data.tar.gz: 850eb20a873d9c9df90dbfab9775e45a710836ea58c6cf8525bbe3cb6b0456f47e1ed87c334142d0681ecc7b69e6331a73b544ef41eb92900ca072f615beffee
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)
@@ -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
@@ -22,6 +22,8 @@ module OpenTelemetry
22
22
  defined?(::Rails)
23
23
  end
24
24
 
25
+ option :enable_recognize_route, default: false, validate: :boolean
26
+
25
27
  private
26
28
 
27
29
  def require_dependencies
@@ -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
@@ -15,7 +15,7 @@ module OpenTelemetry
15
15
  OpenTelemetry::Instrumentation::Rack::Instrumentation.instance.install({})
16
16
 
17
17
  app.middleware.insert_after(
18
- ActionDispatch::RequestId,
18
+ 0,
19
19
  OpenTelemetry::Instrumentation::Rack::Middlewares::TracerMiddleware
20
20
  )
21
21
  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.17.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.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-03-22 00:00:00.000000000 Z
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.16.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.16.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.16.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.16.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.4
261
+ rubygems_version: 3.1.6
248
262
  signing_key:
249
263
  specification_version: 4
250
264
  summary: Rails instrumentation for the OpenTelemetry framework