ruby on rails - ActiveSupport notifications dont have a duration -
we use activesupport notifications log specific network calls (with faraday). in 1 of types of calls, when code reaches
activesupport::notifications.subscribe(notification[:name]) |_name, starts, ends, _, env| handle_notification(starts, ends, env, notification[:service], env[:request_headers][notification[:header]]) end
the starts
, ends
same, can't calculate duration of call. since happens 1 specific call, , code same, notice calls work extracted gems, calls aren't working no in gems. not sure if matters
how can debug/solve this?
the start
, end
values time
objects. if log output of values appear time/date value 2017-01-12 10:51:00 +0100
.
you have convert milliseconds or microseconds see fine values.
you can convert time object milliseconds following:
start.to_f * 1000 end.to_f * 1000
then can work values 1484216765256
in milliseconds , calculate duration subtracting end
start
.
Comments
Post a Comment