Class: RubyZipkin::MetadataLogger
- Inherits:
-
Object
- Object
- RubyZipkin::MetadataLogger
- Defined in:
- lib/ruby-zipkin/metadata_logger.rb
Class Method Summary collapse
-
.log(key, value) ⇒ Object
log a key value pair into a zipkin trace as a KV span value.
-
.log_request(headers) ⇒ Object
Do a full dump of a request header into zipkin.
Class Method Details
.log(key, value) ⇒ Object
log a key value pair into a zipkin trace as a KV span value
9 10 11 12 13 14 15 |
# File 'lib/ruby-zipkin/metadata_logger.rb', line 9 def self.log(key, value) if key.to_s == "action_controller.rescue.request" || key.to_s == "action_controller.rescue.response" ::Trace.record(::Trace::BinaryAnnotation.new(key, value.as_json.to_s, "STRING", ::Trace.default_endpoint)) else ::Trace.record(::Trace::BinaryAnnotation.new(key, value.to_s, "STRING", ::Trace.default_endpoint)) end end |
.log_request(headers) ⇒ Object
Do a full dump of a request header into zipkin.
18 19 20 21 22 23 24 |
# File 'lib/ruby-zipkin/metadata_logger.rb', line 18 def self.log_request(headers) if headers headers.each do |header, value| MetadataLogger.log("HEADER_#{header}", value) end end end |