Class: ZipkinTracer::Config
- Inherits:
-
Object
- Object
- ZipkinTracer::Config
- Defined in:
- lib/zipkin-tracer/config.rb
Overview
Configuration of this gem. It reads the configuration and provides default values
Instance Attribute Summary collapse
-
#annotate_plugin ⇒ Object
readonly
Returns the value of attribute annotate_plugin.
-
#filter_plugin ⇒ Object
readonly
Returns the value of attribute filter_plugin.
-
#json_api_host ⇒ Object
readonly
Returns the value of attribute json_api_host.
-
#log_tracing ⇒ Object
readonly
Returns the value of attribute log_tracing.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#sample_rate ⇒ Object
readonly
Returns the value of attribute sample_rate.
-
#service_name ⇒ Object
readonly
Returns the value of attribute service_name.
-
#service_port ⇒ Object
readonly
Returns the value of attribute service_port.
-
#whitelist_plugin ⇒ Object
readonly
Returns the value of attribute whitelist_plugin.
-
#zookeeper ⇒ Object
readonly
Returns the value of attribute zookeeper.
Instance Method Summary collapse
- #adapter ⇒ Object
-
#initialize(app, config_hash) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(app, config_hash) ⇒ Config
Returns a new instance of Config.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/zipkin-tracer/config.rb', line 11 def initialize(app, config_hash) config = config_hash || Application.config(app) @service_name = config[:service_name] @service_port = config[:service_port] || DEFAULTS[:service_port] @json_api_host = config[:json_api_host] @zookeeper = config[:zookeeper] @sample_rate = config[:sample_rate] || DEFAULTS[:sample_rate] @annotate_plugin = config[:annotate_plugin] # call for trace annotation @filter_plugin = config[:filter_plugin] # skip tracing if returns false @whitelist_plugin = config[:whitelist_plugin] # force sampling if returns true @logger = Application.logger @log_tracing = config[:log_tracing] # Was the logger in fact setup by the client? end |
Instance Attribute Details
#annotate_plugin ⇒ Object (readonly)
Returns the value of attribute annotate_plugin.
7 8 9 |
# File 'lib/zipkin-tracer/config.rb', line 7 def annotate_plugin @annotate_plugin end |
#filter_plugin ⇒ Object (readonly)
Returns the value of attribute filter_plugin.
7 8 9 |
# File 'lib/zipkin-tracer/config.rb', line 7 def filter_plugin @filter_plugin end |
#json_api_host ⇒ Object (readonly)
Returns the value of attribute json_api_host.
7 8 9 |
# File 'lib/zipkin-tracer/config.rb', line 7 def json_api_host @json_api_host end |
#log_tracing ⇒ Object (readonly)
Returns the value of attribute log_tracing.
7 8 9 |
# File 'lib/zipkin-tracer/config.rb', line 7 def log_tracing @log_tracing end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
7 8 9 |
# File 'lib/zipkin-tracer/config.rb', line 7 def logger @logger end |
#sample_rate ⇒ Object (readonly)
Returns the value of attribute sample_rate.
7 8 9 |
# File 'lib/zipkin-tracer/config.rb', line 7 def sample_rate @sample_rate end |
#service_name ⇒ Object (readonly)
Returns the value of attribute service_name.
7 8 9 |
# File 'lib/zipkin-tracer/config.rb', line 7 def service_name @service_name end |
#service_port ⇒ Object (readonly)
Returns the value of attribute service_port.
7 8 9 |
# File 'lib/zipkin-tracer/config.rb', line 7 def service_port @service_port end |
#whitelist_plugin ⇒ Object (readonly)
Returns the value of attribute whitelist_plugin.
7 8 9 |
# File 'lib/zipkin-tracer/config.rb', line 7 def whitelist_plugin @whitelist_plugin end |
#zookeeper ⇒ Object (readonly)
Returns the value of attribute zookeeper.
7 8 9 |
# File 'lib/zipkin-tracer/config.rb', line 7 def zookeeper @zookeeper end |
Instance Method Details
#adapter ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/zipkin-tracer/config.rb', line 25 def adapter if present?(@json_api_host) :json elsif present?(@zookeeper) && RUBY_PLATFORM == 'java' :kafka elsif !!@log_tracing :logger else nil end end |