Sha256: 3fa80f8eb0531b835595fad857ab223dee49ebada9aac28fae4ce9eed5bbf107

Contents?: true

Size: 761 Bytes

Versions: 2

Compression:

Stored size: 761 Bytes

Contents

# add the resolved controller and action to the trace
module Caliper
  module Rails
    module AppendInfo
      extend ActiveSupport::Concern

      included do
        before_filter :add_request_info_to_tracer
      end

      def add_request_info_to_tracer
        return true unless env['caliper.tracer'] # elegantly fail if something went wrong with middleware and also when errors are handled
        request.env["caliper.tracer"].reqs = "#{params[:controller]}##{params[:action]}"

        # check if developer has added customer data
        if defined? self.add_to_caliper_trace
          request.env["caliper.tracer"].add_to_trace(self.add_to_caliper_trace)
        end

        # TODO: add other parameters for the trace?
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
caliper-0.0.2 lib/caliper/rails/append_info.rb
caliper-0.0.1 lib/caliper/rails/append_info.rb