opentelemetry-instrumentation-rack 0.14.0 → 0.19.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: e9824c0e3b21a61e9c69c51e68dae7c56c93dbc03a7bec1ce73d2e2876d14d11
4
- data.tar.gz: 9e72aba3d3819902feb17b41b6b4203fbee4435c418b6f828f6a1336697c13dd
3
+ metadata.gz: 5a8ea2dcf452483145e02d30aa2fbccbc1082c335237fdac4df6e2721517c4be
4
+ data.tar.gz: 8d877d78933707ea7fe9ff14e567d64578a3eb697322127a007968379e5b1654
5
5
  SHA512:
6
- metadata.gz: c0bf72d4acdb549a9ce22e2de5ec8618e7a9a4534623203c66c039ed9165f06afaae6399b2d879b802f1c5ec39bf70193136396f11a07dd6521c2901c32029f2
7
- data.tar.gz: 7e7b9fb9a10ccc9bf0b055dc479375c0e88a957a0f576ad2b9a70472c9517456fdb1d6caf1af15300426176dc770c132253ab40ed132efc0850496fb5e2451bc
6
+ metadata.gz: 0732bb1a667a1ef5863317a7babae71a97259b74daa9081709700ef4137e9acbe2cf808150a4c5118f6b712831acb7961694aa2ed368c962107b1387d2e89e17
7
+ data.tar.gz: 7994946a7d730cc4408f1a67fc648b9a1fed8784e4898ad3ff0615e05c96bdbee0c4bc827c7eac828c6a10467980d705e764d2f4e5c7e938792d4078bf0238d7
data/CHANGELOG.md CHANGED
@@ -1,15 +1,44 @@
1
1
  # Release History: opentelemetry-instrumentation-rack
2
2
 
3
+ ### v0.19.0 / 2021-06-23
4
+
5
+ * BREAKING CHANGE: Total order constraint on span.status=
6
+
7
+ * ADDED: Add Tracer.non_recording_span to API
8
+ * FIXED: Total order constraint on span.status=
9
+
10
+ ### v0.18.0 / 2021-05-21
11
+
12
+ * ADDED: Updated API depedency for 1.0.0.rc1
13
+ * FIXED: Removed http.status_text attribute #750
14
+
15
+ ### v0.17.0 / 2021-04-22
16
+
17
+ * (No significant changes)
18
+
19
+ ### v0.16.0 / 2021-03-17
20
+
21
+ * BREAKING CHANGE: Pass env to url quantization rack config to allow more flexibility
22
+
23
+ * ADDED: Pass env to url quantization rack config to allow more flexibility
24
+ * ADDED: Add rack instrumentation config option to accept callable to filter requests to trace
25
+ * FIXED: Example scripts now reference local common lib
26
+ * DOCS: Replace Gitter with GitHub Discussions
27
+
28
+ ### v0.15.0 / 2021-02-18
29
+
30
+ * ADDED: Add instrumentation config validation
31
+
3
32
  ### v0.14.0 / 2021-02-03
4
33
 
5
- * BREAKING CHANGE: Replace getter and setter callables and remove rack specific propagators
34
+ * BREAKING CHANGE: Replace getter and setter callables and remove rack specific propagators
6
35
 
7
- * ADDED: Replace getter and setter callables and remove rack specific propagators
8
- * ADDED: Add untraced endpoints config to rack middleware
36
+ * ADDED: Replace getter and setter callables and remove rack specific propagators
37
+ * ADDED: Add untraced endpoints config to rack middleware
9
38
 
10
39
  ### v0.13.0 / 2021-01-29
11
40
 
12
- * FIXED: Only include user agent when present
41
+ * FIXED: Only include user agent when present
13
42
 
14
43
  ### v0.12.0 / 2020-12-24
15
44
 
@@ -17,11 +46,11 @@
17
46
 
18
47
  ### v0.11.0 / 2020-12-11
19
48
 
20
- * FIXED: Copyright comments to not reference year
49
+ * FIXED: Copyright comments to not reference year
21
50
 
22
51
  ### v0.10.1 / 2020-12-09
23
52
 
24
- * FIXED: Rack current_span
53
+ * FIXED: Rack current_span
25
54
 
26
55
  ### v0.10.0 / 2020-12-03
27
56
 
@@ -29,24 +58,24 @@
29
58
 
30
59
  ### v0.9.0 / 2020-11-27
31
60
 
32
- * BREAKING CHANGE: Add timeout for force_flush and shutdown
61
+ * BREAKING CHANGE: Add timeout for force_flush and shutdown
33
62
 
34
- * ADDED: Instrument rails
35
- * ADDED: Add timeout for force_flush and shutdown
63
+ * ADDED: Instrument rails
64
+ * ADDED: Add timeout for force_flush and shutdown
36
65
 
37
66
  ### v0.8.0 / 2020-10-27
38
67
 
39
- * BREAKING CHANGE: Move context/span methods to Trace module
40
- * BREAKING CHANGE: Remove 'canonical' from status codes
68
+ * BREAKING CHANGE: Move context/span methods to Trace module
69
+ * BREAKING CHANGE: Remove 'canonical' from status codes
41
70
 
42
- * FIXED: Move context/span methods to Trace module
43
- * FIXED: Remove 'canonical' from status codes
71
+ * FIXED: Move context/span methods to Trace module
72
+ * FIXED: Remove 'canonical' from status codes
44
73
 
45
74
  ### v0.7.0 / 2020-10-07
46
75
 
47
- * FIXED: Remove superfluous file from Rack gem
48
- * DOCS: Added README for Rack Instrumentation
49
- * DOCS: Standardize toplevel docs structure and readme
76
+ * FIXED: Remove superfluous file from Rack gem
77
+ * DOCS: Added README for Rack Instrumentation
78
+ * DOCS: Standardize toplevel docs structure and readme
50
79
 
51
80
  ### v0.6.0 / 2020-09-10
52
81
 
data/README.md CHANGED
@@ -38,7 +38,7 @@ Example usage can be seen in the `./example/trace_demonstration.rb` file [here](
38
38
 
39
39
  The `opentelemetry-instrumentation-rack` gem source is [on github][repo-github], along with related gems including `opentelemetry-api` and `opentelemetry-sdk`.
40
40
 
41
- The OpenTelemetry Ruby gems are maintained by the OpenTelemetry-Ruby special interest group (SIG). You can get involved by joining us on our [gitter channel][ruby-gitter] or attending our weekly meeting. See the [meeting calendar][community-meetings] for dates and times. For more information on this and other language SIGs, see the OpenTelemetry [community page][ruby-sig].
41
+ The OpenTelemetry Ruby gems are maintained by the OpenTelemetry-Ruby special interest group (SIG). You can get involved by joining us in [GitHub Discussions][discussions-url] or attending our weekly meeting. See the [meeting calendar][community-meetings] for dates and times. For more information on this and other language SIGs, see the OpenTelemetry [community page][ruby-sig].
42
42
 
43
43
  ## License
44
44
 
@@ -50,4 +50,4 @@ The `opentelemetry-instrumentation-rack` gem is distributed under the Apache 2.0
50
50
  [license-github]: https://github.com/open-telemetry/opentelemetry-ruby/blob/main/LICENSE
51
51
  [ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
52
52
  [community-meetings]: https://github.com/open-telemetry/community#community-meetings
53
- [ruby-gitter]: https://gitter.im/open-telemetry/opentelemetry-ruby
53
+ [discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
@@ -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,15 @@ module OpenTelemetry
22
22
  defined?(::Rack)
23
23
  end
24
24
 
25
+ option :allowed_request_headers, default: [], validate: :array
26
+ option :allowed_response_headers, default: [], validate: :array
27
+ option :application, default: nil, validate: :callable
28
+ option :record_frontend_span, default: false, validate: :boolean
29
+ option :retain_middleware_names, default: false, validate: :boolean
30
+ option :untraced_endpoints, default: [], validate: :array
31
+ option :url_quantization, default: nil, validate: :callable
32
+ option :untraced_requests, default: nil, validate: :callable
33
+
25
34
  private
26
35
 
27
36
  def require_dependencies
@@ -49,7 +49,7 @@ module OpenTelemetry
49
49
 
50
50
  def initialize(app)
51
51
  @app = app
52
- @untraced_endpoints = config[:untraced_endpoints].is_a?(Array) ? config[:untraced_endpoints] : []
52
+ @untraced_endpoints = config[:untraced_endpoints]
53
53
  end
54
54
 
55
55
  def call(env) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
@@ -67,7 +67,7 @@ module OpenTelemetry
67
67
 
68
68
  # restore extracted context in this process:
69
69
  OpenTelemetry::Context.with_current(frontend_context || extracted_context) do
70
- request_span_name = create_request_span_name(env['REQUEST_URI'] || original_env['PATH_INFO'])
70
+ request_span_name = create_request_span_name(env['REQUEST_URI'] || original_env['PATH_INFO'], env)
71
71
  request_span_kind = frontend_context.nil? ? :server : :internal
72
72
  tracer.in_span(request_span_name,
73
73
  attributes: request_span_attributes(env: env),
@@ -86,7 +86,10 @@ module OpenTelemetry
86
86
  private
87
87
 
88
88
  def untraced_request?(env)
89
- @untraced_endpoints.include?(env['PATH_INFO'])
89
+ return true if @untraced_endpoints.include?(env['PATH_INFO'])
90
+ return true if config[:untraced_requests]&.call(env)
91
+
92
+ false
90
93
  end
91
94
 
92
95
  # return Context with the frontend span as the current span
@@ -138,25 +141,24 @@ module OpenTelemetry
138
141
  # strip off query param value, keep param name)
139
142
  #
140
143
  # see http://github.com/open-telemetry/opentelemetry-specification/pull/416/files
141
- def create_request_span_name(request_uri_or_path_info)
144
+ def create_request_span_name(request_uri_or_path_info, env)
142
145
  # NOTE: dd-trace-rb has implemented 'quantization' (which lowers url cardinality)
143
146
  # see Datadog::Quantization::HTTP.url
144
147
 
145
148
  if (implementation = config[:url_quantization])
146
- implementation.call(request_uri_or_path_info)
149
+ implementation.call(request_uri_or_path_info, env)
147
150
  else
148
151
  request_uri_or_path_info
149
152
  end
150
153
  end
151
154
 
152
155
  def set_attributes_after_request(span, status, headers, _response)
153
- span.status = OpenTelemetry::Trace::Status.http_to_status(status)
156
+ span.status = OpenTelemetry::Trace::Status.error unless (100..399).include?(status.to_i)
154
157
  span.set_attribute('http.status_code', status)
155
158
 
156
159
  # NOTE: if data is available, it would be good to do this:
157
160
  # set_attribute('http.route', ...
158
161
  # e.g., "/users/:userID?
159
- span.set_attribute('http.status_text', ::Rack::Utils::HTTP_STATUS_CODES[status])
160
162
 
161
163
  allowed_response_headers(headers).each { |k, v| span.set_attribute(k, v) }
162
164
  end
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module Rack
10
- VERSION = '0.14.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-rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.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-02-03 00:00:00.000000000 Z
11
+ date: 2021-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.14.0
19
+ version: 1.0.0.rc2
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.14.0
26
+ version: 1.0.0.rc2
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.18.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.18.1
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: appraisal
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +86,14 @@ dependencies:
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: '0.0'
89
+ version: 1.0.0.rc1
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: '0.0'
96
+ version: 1.0.0.rc1
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rack
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -214,10 +228,10 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby
214
228
  licenses:
215
229
  - Apache-2.0
216
230
  metadata:
217
- changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-rack/v0.14.0/file.CHANGELOG.html
231
+ changelog_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-rack/v0.19.0/file.CHANGELOG.html
218
232
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby/tree/main/instrumentation/rack
219
233
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby/issues
220
- documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-rack/v0.14.0
234
+ documentation_uri: https://open-telemetry.github.io/opentelemetry-ruby/opentelemetry-instrumentation-rack/v0.19.0
221
235
  post_install_message:
222
236
  rdoc_options: []
223
237
  require_paths:
@@ -233,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
233
247
  - !ruby/object:Gem::Version
234
248
  version: '0'
235
249
  requirements: []
236
- rubygems_version: 3.1.4
250
+ rubygems_version: 3.1.6
237
251
  signing_key:
238
252
  specification_version: 4
239
253
  summary: Rack instrumentation for the OpenTelemetry framework