lib/opentelemetry/instrumentation/grape/event_handler.rb in opentelemetry-instrumentation-grape-0.1.1 vs lib/opentelemetry/instrumentation/grape/event_handler.rb in opentelemetry-instrumentation-grape-0.1.2
- old
+ new
@@ -77,10 +77,10 @@
# an error raised during the execution of the &block associated to the Notification.
def handle_payload_exception(span, exception)
# Only record exceptions if they were not raised (i.e. do not have a status code in Grape)
# or do not have a 5xx status code. These exceptions are recorded by Rack.
# See instrumentation/rack/lib/opentelemetry/instrumentation/rack/middlewares/tracer_middleware.rb#L155
- return unless exception.respond_to?('status') && exception.status.to_i < 500
+ return unless exception.respond_to?('status') && ::Rack::Utils.status_code(exception.status) < 500
span.record_exception(exception)
span.status = OpenTelemetry::Trace::Status.error("Unhandled exception of type: #{exception.class}")
end