Class: Trace::ZipkinLoggerTracer
- Inherits:
-
ZipkinTracerBase
- Object
- Tracer
- ZipkinTracerBase
- Trace::ZipkinLoggerTracer
- Defined in:
- lib/zipkin-tracer/zipkin_logger_tracer.rb
Constant Summary collapse
- TRACING_KEY =
'Tracing information'
Instance Method Summary collapse
- #flush! ⇒ Object
-
#initialize(options) ⇒ ZipkinLoggerTracer
constructor
A new instance of ZipkinLoggerTracer.
Methods inherited from ZipkinTracerBase
#end_span, #start_span, #with_new_span
Constructor Details
#initialize(options) ⇒ ZipkinLoggerTracer
Returns a new instance of ZipkinLoggerTracer.
9 10 11 12 13 |
# File 'lib/zipkin-tracer/zipkin_logger_tracer.rb', line 9 def initialize() @logger = [:logger] @logger_accepts_data = @logger.respond_to?(:info_with_data) super() end |
Instance Method Details
#flush! ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/zipkin-tracer/zipkin_logger_tracer.rb', line 15 def flush! formatted_spans = ::ZipkinTracer::HostnameResolver.new.spans_with_ips(spans).map(&:to_h) if @logger_accepts_data @logger.info_with_data(TRACING_KEY, formatted_spans) else @logger.info({ TRACING_KEY => formatted_spans }.to_json) end end |