Module: ElasticAPM::Spies::SinatraSpy::Ext Private

Defined in:
lib/elastic_apm/spies/sinatra.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#compile_template(engine, data, opts, *args, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



36
37
38
39
40
41
42
43
44
# File 'lib/elastic_apm/spies/sinatra.rb', line 36

def compile_template(engine, data, opts, *args, &block)
  opts[:__elastic_apm_template_name] =
    case data
    when Symbol then data.to_s
    else format('Inline %s', engine)
    end

  super(engine, data, opts, *args, &block)
end

#dispatch!(*args, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



27
28
29
30
31
32
33
34
# File 'lib/elastic_apm/spies/sinatra.rb', line 27

def dispatch!(*args, &block)
  super(*args, &block).tap do
    next unless (transaction = ElasticAPM.current_transaction)
    next unless (route = env['sinatra.route'])

    transaction.name = route
  end
end