Module: OpenTelemetry::Adapters::Sinatra::Extensions::TracerExtension
- Defined in:
- lib/opentelemetry/adapters/sinatra/extensions/tracer_extension.rb
Overview
Sinatra extension that installs TracerMiddleware and provides tracing for template rendering
Class Method Summary collapse
-
.registered(app) ⇒ Object
Sinatra hook after extension is registered.
Class Method Details
.registered(app) ⇒ Object
Sinatra hook after extension is registered
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/opentelemetry/adapters/sinatra/extensions/tracer_extension.rb', line 17 def self.registered(app) # Create tracing `render` method ::Sinatra::Base.module_eval do def render(_engine, data, *) template_name = data.is_a?(Symbol) ? data : :literal Sinatra::Adapter.instance.tracer.in_span( 'sinatra.render_template', attributes: { 'sinatra.template_name' => template_name.to_s } ) do super end end end app.use Middlewares::TracerMiddleware end |