Skip to content

Commit 6c0fa74

Browse files
committed
squash: remove redundant tests
1 parent ea07e07 commit 6c0fa74

File tree

2 files changed

+7
-41
lines changed

2 files changed

+7
-41
lines changed

instrumentation/action_pack/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ This instrumentation generally uses [HTTP server semantic conventions](https://o
4848

4949
For Rails 7.1+, the span name is updated to match the HTTP method and route that was matched for the request using [`ActionDispatch::Request#route_uri_pattern`](https://api.rubyonrails.org/classes/ActionDispatch/Request.html#method-i-route_uri_pattern), e.g.: `GET /users/:id`
5050

51-
For older versions of Rails the span name is updated to match the HTTP method, controller, and action name that was the target of the request, e.g.: `GET /example/index`
52-
5351
> ![NOTE]: Users may override the `span_naming` option to default to Legacy Span Naming Behavior that uses the controller's class name and action in Ruby documentation syntax, e.g. `ExampleController#index`.
5452
5553
This instrumentation does not emit any custom attributes.
@@ -58,7 +56,7 @@ This instrumentation does not emit any custom attributes.
5856
| - | - | - |
5957
| `code.namespace` | String | `ActionController` class name |
6058
| `code.function` | String | `ActionController` action name e.g. `index`, `show`, `edit`, etc... |
61-
| `http.route` | String | (Rails 7.1+) the route that was matched for the request |
59+
| `http.route` | String | The route that was matched for the request |
6260
| `http.target` | String | The `request.filtered_path` |
6361

6462
### Error Handling for Action Controller

instrumentation/action_pack/test/opentelemetry/instrumentation/action_pack/handlers/action_controller_test.rb

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@
5959
end
6060

6161
it 'strips (:format) from http.route' do
62-
skip "Rails #{Rails.gem_version} does not define ActionDispatch::Request#route_uri_pattern" if Rails.gem_version < Gem::Version.new('7.1')
63-
6462
get 'items/1234'
6563

6664
_(span.attributes['http.route']).must_equal '/items/:id'
@@ -150,51 +148,21 @@
150148
describe 'span naming' do
151149
describe 'when using the default span_naming configuration' do
152150
describe 'successful requests' do
153-
describe 'Rails Version < 7.1' do
154-
it 'uses the http method controller and action name' do
155-
skip "Rails #{Rails.gem_version} uses ActionDispatch::Request#route_uri_pattern" if Rails.gem_version >= Gem::Version.new('7.1')
156-
get '/ok'
157-
158-
_(span.name).must_equal 'GET /example/ok'
159-
end
160-
161-
it 'excludes route params' do
162-
skip "Rails #{Rails.gem_version} uses ActionDispatch::Request#route_uri_pattern" if Rails.gem_version >= Gem::Version.new('7.1')
163-
get '/items/1234'
151+
it 'uses the Rails route' do
152+
get '/ok'
164153

165-
_(span.name).must_equal 'GET /example/item'
166-
end
154+
_(span.name).must_equal 'GET /ok'
167155
end
168156

169-
describe 'Rails Version >= 7.1' do
170-
it 'uses the Rails route' do
171-
skip "Rails #{Rails.gem_version} does not define ActionDispatch::Request#route_uri_pattern" if Rails.gem_version < Gem::Version.new('7.1')
172-
get '/ok'
157+
it 'includes route params' do
158+
get '/items/1234'
173159

174-
_(span.name).must_equal 'GET /ok'
175-
end
176-
177-
it 'includes route params' do
178-
skip "Rails #{Rails.gem_version} does not define ActionDispatch::Request#route_uri_pattern" if Rails.gem_version < Gem::Version.new('7.1')
179-
get '/items/1234'
180-
181-
_(span.name).must_equal 'GET /items/:id'
182-
end
160+
_(span.name).must_equal 'GET /items/:id'
183161
end
184162
end
185163

186164
describe 'server errors' do
187-
it 'uses the http method controller and action name for server side errors' do
188-
skip "Rails #{Rails.gem_version} uses ActionDispatch::Request#route_uri_pattern" if Rails.gem_version >= Gem::Version.new('7.1')
189-
190-
get 'internal_server_error'
191-
192-
_(span.name).must_equal 'GET /example/internal_server_error'
193-
end
194-
195165
it 'uses the Rails route for server side errors' do
196-
skip "Rails #{Rails.gem_version} uses ActionDispatch::Request#route_uri_pattern" if Rails.gem_version < Gem::Version.new('7.1')
197-
198166
get 'internal_server_error'
199167

200168
_(span.name).must_equal 'GET /internal_server_error'

0 commit comments

Comments
 (0)