lib/imprint/tracer.rb in imprint-1.4.3.pre vs lib/imprint/tracer.rb in imprint-1.4.3.pre2
- old
+ new
@@ -7,11 +7,11 @@
TRACER_TIMESTAMP = "TIMESTAMP"
TRACE_CHARS = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten
def self.set_trace_id(id, rack_env = {})
- Thread.current[TRACER_TIMESTAMP] ||= Time.now.to_f
+ Thread.current[TRACER_TIMESTAMP] ||= Time.now.strftime("%Y-%m-%dT%H:%M:%S.%6N")
Thread.current[TRACER_KEY] = id
# setting to the rack_env, gives error tracking support in some systems
rack_env[TRACER_KEY] = id
end
@@ -22,10 +22,10 @@
TRACE_ID_DEFAULT
end
end
def self.get_trace_timestamp
- Thread.current[TRACER_TIMESTAMP] ||= Time.now.to_f
+ Thread.current[TRACER_TIMESTAMP] ||= Time.now.strftime("%Y-%m-%dT%H:%M:%S.%6N")
end
def self.insert_trace_id_in_message(message)
if message && message.is_a?(String) && message.length > 1 && !message.include?('trace_id=')
trace_id = get_trace_id