lib/elastic_apm/spies/tilt.rb in elastic-apm-3.15.1 vs lib/elastic_apm/spies/tilt.rb in elastic-apm-4.0.0.beta.1
- old
+ new
@@ -22,21 +22,22 @@
module Spies
# @api private
class TiltSpy
TYPE = 'template.tilt'
- def install
- ::Tilt::Template.class_eval do
- alias render_without_apm render
+ # @api private
+ module Ext
+ def render(*args, &block)
+ name = options[:__elastic_apm_template_name] || 'Unknown template'
- def render(*args, &block)
- name = options[:__elastic_apm_template_name] || 'Unknown template'
-
- ElasticAPM.with_span name, TYPE do
- render_without_apm(*args, &block)
- end
+ ElasticAPM.with_span name, TYPE do
+ super(*args, &block)
end
end
+ end
+
+ def install
+ ::Tilt::Template.prepend(Ext)
end
end
register 'Tilt::Template', 'tilt/template', TiltSpy.new
end