lib/fiveruns/dash/store/http.rb in fiveruns-dash-ruby-0.7.6 vs lib/fiveruns/dash/store/http.rb in fiveruns-dash-ruby-0.8.0
- old
+ new
@@ -18,11 +18,11 @@
def resolved_hostname(hostname)
if resolved_hostnames[hostname] && Time.now < resolved_hostnames[hostname].next_update
ip = resolved_hostnames[hostname].ip
else
ip = hostname == 'localhost' ? '127.0.0.1' : IPSocket.getaddress(hostname)
- ip_struct = OpenStruct.new(:ip => ip, :next_update => Time.now + 23.hours + rand(60).minutes)
+ ip_struct = OpenStruct.new(:ip => ip, :next_update => Time.now + (23 * 60 * 60) + (rand(60) * 60))
resolved_hostnames[hostname] = ip_struct
end
ip
end
@@ -90,27 +90,27 @@
Fiveruns::Dash.trace_contexts = trace_contexts
end
end
def add_path_to(uri)
- returning uri.dup do |new_uri|
- path = case payload
- when Fiveruns::Dash::PingPayload
- ::File.join('/apps', app_token, "ping")
- when Fiveruns::Dash::InfoPayload
- ::File.join('/apps', app_token, "processes.json")
- when Fiveruns::Dash::DataPayload
- ::File.join('/apps', app_token, "metrics.json")
- when Fiveruns::Dash::TracePayload
- ::File.join('/apps', app_token, "traces.json")
- when Fiveruns::Dash::ExceptionsPayload
- ::File.join('/apps', app_token, "exceptions.json")
- else
- raise ArgumentError, 'Unknown payload type: #{payload.class}'
- end
- new_uri.path = path
+ new_uri = uri.dup
+ path = case payload
+ when Fiveruns::Dash::PingPayload
+ ::File.join('/apps', app_token, "ping")
+ when Fiveruns::Dash::InfoPayload
+ ::File.join('/apps', app_token, "processes.json")
+ when Fiveruns::Dash::DataPayload
+ ::File.join('/apps', app_token, "metrics.json")
+ when Fiveruns::Dash::TracePayload
+ ::File.join('/apps', app_token, "traces.json")
+ when Fiveruns::Dash::ExceptionsPayload
+ ::File.join('/apps', app_token, "exceptions.json")
+ else
+ raise ArgumentError, 'Unknown payload type: #{payload.class}'
end
+ new_uri.path = path
+ new_uri
end
def extra_params_for(payload)
case payload
when Fiveruns::Dash::ExceptionsPayload
@@ -119,19 +119,19 @@
Hash.new
end
end
def normalize_key(key)
- key.to_a.flatten.map(&:to_s).sort
+ key.to_a.flatten.map { |k| k.to_s }.sort
end
def app_token
::Fiveruns::Dash.configuration.options[:app]
end
class Multipart
- BOUNDARY_ROOT = 'B0UND~F0R~UPL0AD'
+ BOUNDARY_ROOT = 'B0UND'
attr_reader :file, :params
def initialize(file, params={})
@file = file
@params = params
\ No newline at end of file