Class: ZipkinTracer::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, config_hash) ⇒ Config

Returns a new instance of Config.



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/zipkin-tracer/config.rb', line 8

def initialize(app, config_hash)
  config = config_hash || app_config(app)
  @service_name      = config[:service_name]
  @service_port      = config[:service_port]
  @scribe_server     = config[:scribe_server]
  @zookeeper         = config[:zookeeper]
  @sample_rate       = config[:sample_rate]       || DEFAULTS[:sample_rate]
  @scribe_max_buffer = config[:scribe_max_buffer] || DEFAULTS[:scribe_max_buffer]
  @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            = config[:logger]            || fallback_logger
end

Instance Attribute Details

#annotate_pluginObject (readonly)

Returns the value of attribute annotate_plugin.



5
6
7
# File 'lib/zipkin-tracer/config.rb', line 5

def annotate_plugin
  @annotate_plugin
end

#filter_pluginObject (readonly)

Returns the value of attribute filter_plugin.



5
6
7
# File 'lib/zipkin-tracer/config.rb', line 5

def filter_plugin
  @filter_plugin
end

#loggerObject (readonly)

Returns the value of attribute logger.



5
6
7
# File 'lib/zipkin-tracer/config.rb', line 5

def logger
  @logger
end

#sample_rateObject (readonly)

Returns the value of attribute sample_rate.



5
6
7
# File 'lib/zipkin-tracer/config.rb', line 5

def sample_rate
  @sample_rate
end

#scribe_max_bufferObject (readonly)

Returns the value of attribute scribe_max_buffer.



5
6
7
# File 'lib/zipkin-tracer/config.rb', line 5

def scribe_max_buffer
  @scribe_max_buffer
end

#scribe_serverObject (readonly)

Returns the value of attribute scribe_server.



5
6
7
# File 'lib/zipkin-tracer/config.rb', line 5

def scribe_server
  @scribe_server
end

#service_nameObject (readonly)

Returns the value of attribute service_name.



5
6
7
# File 'lib/zipkin-tracer/config.rb', line 5

def service_name
  @service_name
end

#service_portObject (readonly)

Returns the value of attribute service_port.



5
6
7
# File 'lib/zipkin-tracer/config.rb', line 5

def service_port
  @service_port
end

#whitelist_pluginObject (readonly)

Returns the value of attribute whitelist_plugin.



5
6
7
# File 'lib/zipkin-tracer/config.rb', line 5

def whitelist_plugin
  @whitelist_plugin
end

#zookeeperObject (readonly)

Returns the value of attribute zookeeper.



5
6
7
# File 'lib/zipkin-tracer/config.rb', line 5

def zookeeper
  @zookeeper
end

Instance Method Details

#using_kafka?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/zipkin-tracer/config.rb', line 26

def using_kafka?
  !!(@zookeeper && RUBY_PLATFORM == 'java' && defined?(::Hermann))
end

#using_scribe?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/zipkin-tracer/config.rb', line 22

def using_scribe?
  !!(@scribe_server && defined?(::Scribe))
end