File tree Expand file tree Collapse file tree 6 files changed +27
-33
lines changed
lib/opentelemetry/instrumentation/ethon/patches
test/opentelemetry/instrumentation/ethon Expand file tree Collapse file tree 6 files changed +27
-33
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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
100100 OpenTelemetry ::Trace ::Status ::ERROR
101101 )
102102 _ ( easy . instance_eval { @otel_span } ) . must_be_nil
103- end
103+ end
104104 end
105105 end
106106
Original file line number Diff line number Diff line change 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
9292 OpenTelemetry ::Trace ::Status ::ERROR
9393 )
9494 _ ( easy . instance_eval { @otel_span } ) . must_be_nil
95- end
95+ end
9696 end
9797 end
9898
Original file line number Diff line number Diff line change 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
9393 OpenTelemetry ::Trace ::Status ::ERROR
9494 )
9595 _ ( easy . instance_eval { @otel_span } ) . must_be_nil
96- end
96+ end
9797 end
9898 end
9999
You can’t perform that action at this time.
0 commit comments