Skip to content

Commit b9b369a

Browse files
committed
fix rubocop errors
1 parent a45437a commit b9b369a

File tree

6 files changed

+27
-33
lines changed

6 files changed

+27
-33
lines changed

instrumentation/ethon/lib/opentelemetry/instrumentation/ethon/patches/dup/easy.rb

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,13 @@ def headers=(headers)
3636
end
3737

3838
def perform
39-
begin
40-
otel_before_request
41-
super
42-
rescue StandardError => e
43-
# If an exception occurs before we can call `complete`, we should add and error status and close the span
44-
@otel_span&.status = OpenTelemetry::Trace::Status.error("Request threw an exception: #{e.message}")
45-
@otel_span&.finish
46-
@otel_span = nil
47-
end
39+
otel_before_request
40+
super
41+
rescue StandardError => e
42+
# If an exception occurs before we can call `complete`, we should add and error status and close the span
43+
@otel_span&.status = OpenTelemetry::Trace::Status.error("Request threw an exception: #{e.message}")
44+
@otel_span&.finish
45+
@otel_span = nil
4846
end
4947

5048
def complete

instrumentation/ethon/lib/opentelemetry/instrumentation/ethon/patches/old/easy.rb

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,13 @@ def headers=(headers)
3333
end
3434

3535
def perform
36-
begin
37-
otel_before_request
38-
super
39-
rescue StandardError => e
40-
# If an exception occurs before we can call `complete`, we should add and error status and close the span
41-
@otel_span&.status = OpenTelemetry::Trace::Status.error("Request threw an exception: #{e.message}")
42-
@otel_span&.finish
43-
@otel_span = nil
44-
end
36+
otel_before_request
37+
super
38+
rescue StandardError => e
39+
# If an exception occurs before we can call `complete`, we should add and error status and close the span
40+
@otel_span&.status = OpenTelemetry::Trace::Status.error("Request threw an exception: #{e.message}")
41+
@otel_span&.finish
42+
@otel_span = nil
4543
end
4644

4745
def complete

instrumentation/ethon/lib/opentelemetry/instrumentation/ethon/patches/stable/easy.rb

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,13 @@ def headers=(headers)
3636
end
3737

3838
def perform
39-
begin
40-
otel_before_request
41-
super
42-
rescue StandardError => e
43-
# If an exception occurs before we can call `complete`, we should add and error status and close the span
44-
@otel_span&.status = OpenTelemetry::Trace::Status.error("Request threw an exception: #{e.message}")
45-
@otel_span&.finish
46-
@otel_span = nil
47-
end
39+
otel_before_request
40+
super
41+
rescue StandardError => e
42+
# If an exception occurs before we can call `complete`, we should add and error status and close the span
43+
@otel_span&.status = OpenTelemetry::Trace::Status.error("Request threw an exception: #{e.message}")
44+
@otel_span&.finish
45+
@otel_span = nil
4846
end
4947

5048
def complete

instrumentation/ethon/test/opentelemetry/instrumentation/ethon/dup/instrumentation_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
end
8585

8686
it 'when the perform fails before complete with an exception' do
87-
Ethon::Curl.stub(:easy_perform, ->(handle) { raise StandardError, "Connection failed" }) do
87+
Ethon::Curl.stub(:easy_perform, ->(_handle) { raise StandardError, 'Connection failed' }) do
8888
easy.perform
8989

9090
# NOTE: check the finished spans since we expect to have closed it
@@ -100,7 +100,7 @@
100100
OpenTelemetry::Trace::Status::ERROR
101101
)
102102
_(easy.instance_eval { @otel_span }).must_be_nil
103-
end
103+
end
104104
end
105105
end
106106

instrumentation/ethon/test/opentelemetry/instrumentation/ethon/old/instrumentation_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
end
8080

8181
it 'when the perform fails before complete with an exception' do
82-
Ethon::Curl.stub(:easy_perform, ->(handle) { raise StandardError, "Connection failed" }) do
82+
Ethon::Curl.stub(:easy_perform, ->(_handle) { raise StandardError, 'Connection failed' }) do
8383
easy.perform
8484

8585
# NOTE: check the finished spans since we expect to have closed it
@@ -92,7 +92,7 @@
9292
OpenTelemetry::Trace::Status::ERROR
9393
)
9494
_(easy.instance_eval { @otel_span }).must_be_nil
95-
end
95+
end
9696
end
9797
end
9898

instrumentation/ethon/test/opentelemetry/instrumentation/ethon/stable/instrumentation_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
end
8181

8282
it 'when the perform fails before complete with an exception' do
83-
Ethon::Curl.stub(:easy_perform, ->(handle) { raise StandardError, "Connection failed" }) do
83+
Ethon::Curl.stub(:easy_perform, ->(_handle) { raise StandardError, 'Connection failed' }) do
8484
easy.perform
8585

8686
# NOTE: check the finished spans since we expect to have closed it
@@ -93,7 +93,7 @@
9393
OpenTelemetry::Trace::Status::ERROR
9494
)
9595
_(easy.instance_eval { @otel_span }).must_be_nil
96-
end
96+
end
9797
end
9898
end
9999

0 commit comments

Comments
 (0)