Sha256: b2e8bf322a78b1b0fde200e371d3b24c66f40628cf187443553119ec8b7ac59b
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
require 'new_relic/agent/method_tracer' require 'benchmark' module NewRelic module Agent module Instrumentation module VerticaInstrumentation def self.included(klass) klass.class_eval do alias_method :query_without_instrumentation, :query alias_method :query, :query_with_instrumentation end end def query_with_instrumentation(sql, options = {}, &block) result = nil duration = Benchmark.realtime do result = query_without_instrumentation(sql, options, &block) end if NewRelic::Agent.is_execution_traced? NewRelic::Agent.instance.transaction_sampler.notice_sql(sql, nil, duration) NewRelic::Agent.instance.stats_engine.get_stats_no_scope('ActiveRecord/all').trace_call(duration) end return result end end end end end DependencyDetection.defer do depends_on do defined?(::Vertica) && defined?(::Vertica::Connection) end executes do ::Vertica::Connection.instance_eval do include ::NewRelic::Agent::Instrumentation::VerticaInstrumentation end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
newrelic-vertica-0.0.3 | lib/newrelic-vertica/vertica.rb |