Module: Zipkin::Encoders::JsonEncoder::LogAnnotations
- Defined in:
- lib/zipkin/encoders/json_encoder/log_annotations.rb
Defined Under Namespace
Modules: Fields
Class Method Summary collapse
Class Method Details
.build(span) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/zipkin/encoders/json_encoder/log_annotations.rb', line 12 def self.build(span) span.logs.map do |log| { Fields::TIMESTAMP => Timestamp.create(log.fetch(:timestamp)), Fields::VALUE => format_log_value(log) } end end |
.format_log_value(log) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/zipkin/encoders/json_encoder/log_annotations.rb', line 21 def self.format_log_value(log) if log.keys == %i[event timestamp] log.fetch(:event) else log .reject { |key, _value| key == :timestamp } .map { |key, value| "#{key}=#{value}" } .join(' ') end end |