Module: OpenTelemetry::Instrumentation::ActionPack::Patches::ActionController::Metal
- Defined in:
- lib/opentelemetry/instrumentation/action_pack/patches/action_controller/metal.rb
Overview
Module to prepend to ActionController::Metal for instrumentation
Instance Method Summary collapse
Instance Method Details
#dispatch(name, request, response) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/opentelemetry/instrumentation/action_pack/patches/action_controller/metal.rb', line 14 def dispatch(name, request, response) rack_span = OpenTelemetry::Instrumentation::Rack.current_span if rack_span.recording? rack_span.name = "#{self.class.name}##{name}" unless request.env['action_dispatch.exception'] attributes_to_append = { OpenTelemetry::SemanticConventions::Trace::CODE_NAMESPACE => self.class.name, OpenTelemetry::SemanticConventions::Trace::CODE_FUNCTION => String(name) } attributes_to_append[OpenTelemetry::SemanticConventions::Trace::HTTP_TARGET] = request.filtered_path if request.filtered_path != request.fullpath rack_span.add_attributes(attributes_to_append) end super(name, request, response) end |