Class: Appsignal::Rack::Utils Private
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Class Method Summary collapse
-
.queue_start_from(env) ⇒ Integer, NilClass
private
Fetch the queue start time from the request environment.
Class Method Details
.queue_start_from(env) ⇒ Integer, NilClass
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Fetch the queue start time from the request environment.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/appsignal/rack.rb', line 18 def self.queue_start_from(env) return unless env env_var = env["HTTP_X_QUEUE_START"] || env["HTTP_X_REQUEST_START"] return unless env_var cleaned_value = env_var.tr("^0-9", "") return if cleaned_value.empty? value = cleaned_value.to_i if value > 4_102_441_200_000 # Value is in microseconds. Transform to milliseconds. value / 1_000 elsif value < 946_681_200_000 # Value is too low to be plausible nil else # Value is in milliseconds value end end |