Class: ZipkinTracer::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/zipkin-tracer/application.rb

Overview

Useful methods on the Application we are instrumenting

Class Method Summary collapse

Class Method Details

.config(app) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/zipkin-tracer/application.rb', line 22

def self.config(app)
  if app.respond_to?(:config) && app.config.respond_to?(:zipkin_tracer)
    app.config.zipkin_tracer
  else
    {}
  end
end

.loggerObject



14
15
16
17
18
19
20
# File 'lib/zipkin-tracer/application.rb', line 14

def self.logger
  if defined?(Rails) # If we happen to be inside a Rails app, use its logger
    Rails.logger
  else
    Logger.new(STDOUT)
  end
end

.routable_request?(path_info) ⇒ Boolean

If the request is not valid for this service, we do not what to trace it.

Returns:

  • (Boolean)


6
7
8
9
10
11
12
# File 'lib/zipkin-tracer/application.rb', line 6

def self.routable_request?(path_info)
  return true unless defined?(Rails) # If not running on a Rails app, we can't verify if it is invalid
  Rails.application.routes.recognize_path(path_info)
  true
rescue ActionController::RoutingError
  false
end