lib/opentelemetry/instrumentation/restclient/patches/request.rb in opentelemetry-instrumentation-restclient-0.18.0 vs lib/opentelemetry/instrumentation/restclient/patches/request.rb in opentelemetry-instrumentation-restclient-0.19.0

- old
+ new

@@ -41,19 +41,15 @@ yield(span).tap do |response| # Verify return value is a response. # If so, add additional attributes. if response.is_a?(::RestClient::Response) span.set_attribute('http.status_code', response.code) - span.status = OpenTelemetry::Trace::Status.http_to_status( - response.code - ) + span.status = OpenTelemetry::Trace::Status.error unless (100..399).include?(response.code.to_i) end end rescue ::RestClient::ExceptionWithResponse => e span.set_attribute('http.status_code', e.http_code) - span.status = OpenTelemetry::Trace::Status.http_to_status( - e.http_code - ) + span.status = OpenTelemetry::Trace::Status.error unless (100..399).include?(e.http_code.to_i) raise e ensure span.finish end