Sha256: ef4755565b4de1e5f3d2c4e5ea751181306f0b898e6b3f8c828d17f54f0e7379
Contents?: true
Size: 1.04 KB
Versions: 3
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true # Copyright 2019 OpenTelemetry Authors # # SPDX-License-Identifier: Apache-2.0 require_relative '../middlewares/tracer_middleware' module OpenTelemetry module Adapters module Sinatra module Extensions # Sinatra extension that installs TracerMiddleware and provides # tracing for template rendering module TracerExtension # Sinatra hook after extension is registered 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 end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems