lib/opentelemetry/instrumentation/grape/event_handler.rb in opentelemetry-instrumentation-grape-0.1.5 vs lib/opentelemetry/instrumentation/grape/event_handler.rb in opentelemetry-instrumentation-grape-0.1.6

- old
+ new

@@ -77,11 +77,11 @@ # 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') && ::Rack::Utils.status_code(exception.status) < 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 @@ -106,10 +106,10 @@ # Convert from CamelCase to snake_case basename.gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase end def built_in_grape_formatter?(formatter) - formatter.respond_to?('name') && formatter.name.include?('Grape::Formatter') + formatter.respond_to?(:name) && formatter.name.include?('Grape::Formatter') end end end end end