lib/instana/frameworks/roda.rb in instana-1.193.2 vs lib/instana/frameworks/roda.rb in instana-1.193.3.pre1
- old
+ new
@@ -2,15 +2,15 @@
module Instana
module RodaPathTemplateExtractor
module RequestMethods
TERM = defined?(::Roda) ? ::Roda::RodaPlugins::Base::RequestMethods::TERM : Object
-
+
def if_match(args, &blk)
path = @remaining_path
captures = @captures.clear
-
+
if match_all(args)
(env['INSTANA_PATH_TEMPLATE_FRAGMENTS'] ||= []).concat(named_args(args, blk))
block_result(blk.(*captures))
env['INSTANA_HTTP_PATH_TEMPLATE'] = env['INSTANA_PATH_TEMPLATE_FRAGMENTS']
.join('/')
@@ -19,29 +19,23 @@
else
@remaining_path = path
false
end
end
-
- def named_args(args, blk)
- parameters = blk.parameters
- args.map do |a|
+
+ def named_args(args, blk)
+ parameters = blk.parameters
+ args.map do |a|
case a
when String
a
when TERM
nil
else
_, name = parameters.pop
"{#{name}}"
end
end.compact
- end
+ end
end
end
-end
-
-if defined?(::Roda)
- ::Instana.logger.debug "Instrumenting Roda"
- Roda.use ::Instana::Rack
- Roda.plugin ::Instana::RodaPathTemplateExtractor
end