Class: RubyZipkin::MetadataLogger
- Inherits:
-
Object
- Object
- RubyZipkin::MetadataLogger
- Defined in:
- lib/rubyzipkin/metadata_logger.rb
Class Method Summary collapse
-
.log(key, value, max_size_bytes = 512) ⇒ Object
log a key value pair into a zipkin trace as a KV span value since logging can ve quite extensive, we set a cap for the max size in bytes for a trace header.
-
.log_request(headers) ⇒ Object
Do a full dump of a request header into zipkin.
Class Method Details
.log(key, value, max_size_bytes = 512) ⇒ Object
log a key value pair into a zipkin trace as a KV span value since logging can ve quite extensive, we set a cap for the max size in bytes for a trace header
10 11 12 13 14 15 16 |
# File 'lib/rubyzipkin/metadata_logger.rb', line 10 def self.log(key, value, max_size_bytes = 512) 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[0..max_size_bytes], "STRING", ::Trace.default_endpoint)) else ::Trace.record(::Trace::BinaryAnnotation.new(key, value.to_s[0..max_size_bytes], "STRING", ::Trace.default_endpoint)) end end |
.log_request(headers) ⇒ Object
Do a full dump of a request header into zipkin.
19 20 21 22 23 24 25 |
# File 'lib/rubyzipkin/metadata_logger.rb', line 19 def self.log_request(headers) if headers headers.each do |header, value| MetadataLogger.log("HEADER_#{header}", value) end end end |