lib/opentelemetry/instrumentation/grape/event_handler.rb in opentelemetry-instrumentation-grape-0.1.0 vs lib/opentelemetry/instrumentation/grape/event_handler.rb in opentelemetry-instrumentation-grape-0.1.1
- old
+ new
@@ -98,12 +98,18 @@
parts = [prefix, version] + namespace.split('/') + endpoint.options[:path]
parts.reject { |p| p.blank? || p.eql?('/') }.join('/').prepend('/')
end
def formatter_type(formatter)
+ return 'custom' unless built_in_grape_formatter?(formatter)
+
basename = formatter.name.split('::').last
# 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')
end
end
end
end
end