Sha256: 929bb26cde04962d9666ff0541b6f711923a7f35e4a70a69fcbe2b0838950844

Contents?: true

Size: 606 Bytes

Versions: 13

Compression:

Stored size: 606 Bytes

Contents

# frozen_string_literal: true

module ElasticAPM
  # @api private
  module Injectors
    # @api private
    class TiltInjector
      TYPE = 'template.tilt'.freeze

      def install
        ::Tilt::Template.class_eval do
          alias render_without_apm render

          def render(*args, &block)
            name = options[:__elastic_apm_template_name] || 'Unknown template'

            ElasticAPM.span name, TYPE do
              render_without_apm(*args, &block)
            end
          end
        end
      end
    end

    register 'Tilt::Template', 'tilt/template', TiltInjector.new
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
elastic-apm-0.6.2 lib/elastic_apm/injectors/tilt.rb
elastic-apm-0.6.1 lib/elastic_apm/injectors/tilt.rb
elastic-apm-0.5.1 lib/elastic_apm/injectors/tilt.rb
elastic-apm-0.5.0 lib/elastic_apm/injectors/tilt.rb
elastic-apm-0.4.5 lib/elastic_apm/injectors/tilt.rb
elastic-apm-0.4.4 lib/elastic_apm/injectors/tilt.rb
elastic-apm-0.4.3 lib/elastic_apm/injectors/tilt.rb
elastic-apm-0.4.2 lib/elastic_apm/injectors/tilt.rb
elastic-apm-0.4.1 lib/elastic_apm/injectors/tilt.rb
elastic-apm-0.4.0 lib/elastic_apm/injectors/tilt.rb
elastic-apm-0.3.0 lib/elastic_apm/injectors/tilt.rb
elastic-apm-0.2.0 lib/elastic_apm/injectors/tilt.rb
elastic-apm-0.1.0 lib/elastic_apm/injectors/tilt.rb