Sha256: 867debfc3e86d086f3fac562e6f541084f6c0052abef5006ebf85890912dd30a
Contents?: true
Size: 919 Bytes
Versions: 5
Compression:
Stored size: 919 Bytes
Contents
require "instana/rack" module Instana module CubaPathTemplateExtractor REPLACE_TARGET = /:(?<term>[^\/]+)/i def self.prepended(base) ::Instana.logger.debug "#{base} prepended #{self}" end def on(*args, &blk) wrapper = lambda do |*caputres| env['INSTANA_PATH_TEMPLATE_FRAGMENTS'] << args .select { |a| a.is_a?(String) } .join('/') blk.call(*captures) end super(*args, &wrapper) end def call!(env) env['INSTANA_PATH_TEMPLATE_FRAGMENTS'] = [] response = super(env) env['INSTANA_HTTP_PATH_TEMPLATE'] = env['INSTANA_PATH_TEMPLATE_FRAGMENTS'] .join('/') .gsub(REPLACE_TARGET, '{\k<term>}') response end end end if defined?(::Cuba) ::Instana.logger.debug "Instrumenting Cuba" Cuba.use ::Instana::Rack Cuba.prepend ::Instana::CubaPathTemplateExtractor end
Version data entries
5 entries across 5 versions & 1 rubygems