lib/ddtrace/contrib/rack/request_queue.rb in ddtrace-0.17.3 vs lib/ddtrace/contrib/rack/request_queue.rb in ddtrace-0.18.0

- old
+ new

@@ -16,12 +16,16 @@ # TODO: this should be generic enough to work with any # frontend web server or load balancer time_string = header.split('t=')[1] return if time_string.nil? + # Return nil if the time is clearly invalid + time_value = time_string.to_f + return if time_value.zero? + # return the request_start only if it's lesser than # current time, to avoid significant clock skew - request_start = Time.at(time_string.to_f) + request_start = Time.at(time_value) request_start.utc > now ? nil : request_start rescue StandardError => e # in case of an Exception we don't create a # `request.queuing` span Datadog::Tracer.log.debug("[rack] unable to parse request queue headers: #{e}")