This repository has been archived by the owner on Jan 2, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bumped the version with newrelic and airbrake setup
- Loading branch information
Showing
4 changed files
with
88 additions
and
2 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module WD | ||
module Sinatra | ||
VERSION = "0.2.5" | ||
VERSION = "0.2.6" | ||
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,16 @@ | ||
common: &default_settings | ||
api_key: 'replace me' | ||
params_filters: | ||
- password | ||
host: 'api.airbrake.io' | ||
enabled: false | ||
|
||
development: | ||
<<: *default_settings | ||
|
||
test: | ||
<<: *default_settings | ||
|
||
production: | ||
<<: *default_settings | ||
enabled: true |
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,66 @@ | ||
require 'new_relic/agent/instrumentation/controller_instrumentation' | ||
|
||
DependencyDetection.defer do | ||
depends_on do | ||
defined?(WeaselDiesel) && defined?(WeaselDiesel::RequestHandler) && | ||
WeaselDiesel::RequestHandler.method_defined?(:dispatch) | ||
end | ||
|
||
executes do | ||
NewRelic::Agent.logger.debug 'Installing WeaselDiesel instrumentation' | ||
end | ||
|
||
executes do | ||
::WeaselDiesel::RequestHandler.class_eval do | ||
include NewRelic::Agent::Instrumentation::WeaselDiesel | ||
include NewRelic::Agent::Instrumentation::ControllerInstrumentation | ||
alias dispatch_without_newrelic dispatch | ||
alias dispatch dispatch_with_newrelic | ||
|
||
add_method_tracer :params_preprocessor_hook if self.method_defined?(:params_preprocessor_hook) | ||
add_method_tracer :params_postprocessor_hook if self.method_defined?(:params_postprocessor_hook) | ||
add_method_tracer :pre_dispatch_hook if self.method_defined?(:pre_dispatch_hook) | ||
end | ||
# Monitor the actual dispatch of each service | ||
WSList.all.each do |service| | ||
service.handler.class_eval do | ||
add_method_tracer :service_dispatch, 'Service/Dispatch' | ||
end | ||
end | ||
end | ||
end | ||
|
||
|
||
module NewRelic | ||
module Agent | ||
module Instrumentation | ||
module WeaselDiesel | ||
include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation | ||
|
||
def dispatch_with_newrelic(app) | ||
perform_action_with_newrelic_trace(:category => :controller, | ||
:class_name => service.class.name, | ||
:controller => service.class.name, | ||
:path => "#{service.verb.upcase} #{service.url}", | ||
:name => "#{service.verb.upcase} #{service.url}", | ||
:params => filter_newrelic_params(app.params), | ||
:request => app.request) do | ||
dispatch_without_newrelic(app) | ||
end | ||
end | ||
|
||
# filter params based the newrelic.yml entry if it exists. | ||
def filter_newrelic_params(params) | ||
@filters ||= NewRelic::Control.instance['filter_parameters'] | ||
return params if @filters.nil? || @filters.empty? | ||
duped_params = params.dup | ||
duped_params.each{|k,v| duped_params[k] = 'FILTERED' if @filters.include?(k) } | ||
duped_params | ||
end | ||
|
||
end | ||
end | ||
end | ||
end | ||
|
||
DependencyDetection.detect! |