on error in get_latencies send details to bugsnag

This commit is contained in:
Nuwan 2021-05-12 19:51:29 +05:30
parent 93b848c2d8
commit 9dac3fdb56
2 changed files with 11 additions and 2 deletions

View File

@ -942,16 +942,26 @@ class ApiUsersController < ApiController
url = URI(latency_url)
begin
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true if Rails.env.production?
http.use_ssl = true if Rails.application.config.latency_data_host.start_with?("https://")
request = Net::HTTP::Get.new(url)
request["Authorization"] = "Basic #{Rails.application.config.latency_data_host_auth_code}"
response = http.request(request)
if response.is_a?(Net::HTTPOK) || response.is_a?(Net::HTTPSuccess)
render json: response.body, status: 200
else
Bugsnag.notify(exception) do |report|
report.severity = "warning"
report.add_tab(:latency, {
user_id: current_user.id,
name: current_user.name,
user_ids: params[:user_ids],
url: latency_url
})
end
render json: {}, status: 422
end
rescue
Bugsnag.notify("Latency server returned code: #{response.code}")
render json: {}, status: 500
end
end

View File

@ -1,4 +1,3 @@
gcp_stats_host
def audiomixer_workspace_path
if ENV['WORKSPACE']
dev_path = ENV['WORKSPACE']