Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Bill Kayser
committed
May 13, 2010
1 parent
217ad22
commit 39938d5
Showing
5 changed files
with
72 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
if defined?(::ActsAsSolr) | ||
|
||
module NewRelic | ||
module Instrumentation | ||
module ActsAsSolrInstrumentation | ||
module ParserMethodsInstrumentation | ||
def parse_query_with_newrelic(*args) | ||
self.class.trace_execution_scoped(["SolrClient/ActsAsSolr/query"]) do | ||
t0 = Time.now | ||
begin | ||
parse_query_without_newrelic(*args) | ||
ensure | ||
NewRelic::Agent.instance.transaction_sampler.notice_nosql(args.first.inspect, (Time.now - t0).to_f) rescue nil | ||
end | ||
end | ||
|
||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
module ActsAsSolr | ||
module ParserMethods #:nodoc | ||
include NewRelic::Instrumentation::ActsAsSolrInstrumentation::ParserMethodsInstrumentation | ||
alias :parse_query_without_newrelic :parse_query | ||
alias :parse_query :parse_query_with_newrelic | ||
end | ||
|
||
module ClassMethods #:nodoc | ||
%w[find_by_solr find_id_by_solr multi_solr_search count_by_solr].each do |method| | ||
add_method_tracer method, 'SolrClient/ActsAsSolr/query' | ||
end | ||
add_method_tracer :rebuild_solr_index, 'SolrClient/ActsAsSolr/index' | ||
end | ||
|
||
module CommonMethods #:nodoc | ||
add_method_tracer :solr_add, 'SolrClient/ActsAsSolr/add' | ||
add_method_tracer :solr_delete, 'SolrClient/ActsAsSolr/delete' | ||
add_method_tracer :solr_commit, 'SolrClient/ActsAsSolr/commit' | ||
add_method_tracer :solr_optimize, 'SolrClient/ActsAsSolr/optimize' | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
if defined?(::Sunspot) | ||
::Sunspot.module_eval do | ||
class << self | ||
%w(index index!).each do |method| | ||
add_method_tracer method, 'SolrClient/Sunspot/index' | ||
end | ||
add_method_tracer :commit, 'SolrClient/Sunspot/commit' | ||
|
||
%w[search more_like_this].each do |method| | ||
add_method_tracer method, 'SolrClient/Sunspot/query' | ||
end | ||
%w[remove remove! remove_by_id remove_by_id! remove_all remove_all!].each do |method| | ||
add_method_tracer method, 'SolrClient/Sunspot/delete' | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters