Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug revise of monkey patch without Rails gem #130

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/zipkin-tracer/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ module ZipkinTracer
class Application
# If the request is not valid for this service, we do not what to trace it.
def self.routable_request?(path_info, http_method)
return true unless defined?(Rails) # If not running on a Rails app, we can't verify if it is invalid
return true unless defined?(Rails.application) # If not running on a Rails app, we can't verify if it is invalid
Rails.application.routes.recognize_path(path_info, method: http_method)
true
rescue ActionController::RoutingError
false
end

def self.get_route(env)
return nil unless defined?(Rails)
return nil unless defined?(Rails.application)
req = Rack::Request.new(env)
# Returns a string like /some/path/:id
Rails.application.routes.router.recognize(req) do |route|
Expand Down