Sha256: 271031a183a657baa4ab8e92c9a9603e9cabc49d557d66baab17ce3a58be7c62
Contents?: true
Size: 1.2 KB
Versions: 2
Compression:
Stored size: 1.2 KB
Contents
# encoding: utf-8 require 'ting_yun/agent/transaction' require 'ting_yun/agent/transaction/transaction_state' TingYun::Support::LibraryDetection.defer do named :grape depends_on do defined?(::Grape) && defined?(::Grape::Endpoint) end executes do TingYun::Agent.logger.info 'Installing grape instrumentation' end executes do ::Grape::Endpoint.class_eval do def run_with_tingyun(*args) begin name = ["Grape", self.options[:method].first, self.options[:for].to_s, self.namespace.to_s.sub(%r{\A/}, ''), # removing leading slashes self.options[:path].first.to_s.sub(%r{\A/}, ''), ].compact.select{ |n| n.to_s unless n.to_s.empty? }.join("/") TingYun::Agent::Transaction.set_default_transaction_name(name, :controller) run_without_tingyun(*args) rescue => e TingYun::Agent.logger.info("Error getting Grape Endpoint Name. Error: #{e.message}. Options: #{self.options.inspect}") TingYun::Agent.notice_error(e,:type=>:exception) raise e end end alias run_without_tingyun run alias run run_with_tingyun end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tingyun_rpm-1.6.1 | lib/ting_yun/instrumentation/grape.rb |
tingyun_rpm-1.5.0 | lib/ting_yun/instrumentation/grape.rb |