Sha256: e1ec16329ae327042bac46ec65075478603b199a358fea33e5bca49b21525d64
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
# frozen_string_literal: true # Copyright The OpenTelemetry Authors # # SPDX-License-Identifier: Apache-2.0 module OpenTelemetry module Instrumentation module Rails module Patches module ActionController # Module to prepend to ActionController::Metal for instrumentation module Metal def dispatch(name, request, response) rack_span = OpenTelemetry::Instrumentation::Rack.current_span rack_span.name = "#{self.class.name}##{name}" if rack_span.context.valid? && !request.env['action_dispatch.exception'] add_rails_route(rack_span, request) if instrumentation_config[:enable_recognize_route] super(name, request, response) end private def add_rails_route(rack_span, request) ::Rails.application.routes.router.recognize(request) do |route, _params| rack_span.set_attribute('http.route', route.path.spec.to_s) end end def instrumentation_config Rails::Instrumentation.instance.config end end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems