add extra fields to crash reports

This commit is contained in:
Peter Walker 2017-10-25 22:54:22 -05:00
parent d60871382f
commit d4f1c44fc1
5 changed files with 12 additions and 6 deletions

View File

@ -12,6 +12,7 @@ ActiveAdmin.register JamRuby::CrashDump, :as => 'Crash Dump' do
column 'User' do |oo| oo.user ? link_to(oo.user.email, oo.user.admin_url, {:title => oo.user.email}) : '' end
column "Client Version", :client_version
column "Client Type", :client_type
column "Crash Context", :crash_context
column "Download" do |post|
link_to 'Link', post.sign_url
end

View File

@ -3,3 +3,4 @@ CREATE INDEX crash_dumps_client_id_idx ON crash_dumps(client_id);
CREATE INDEX crash_dumps_timestamp_idx ON crash_dumps(timestamp);
ALTER TABLE crash_dumps ADD COLUMN client_version VARCHAR(100) NOT NULL;
ALTER TABLE crash_dumps ADD COLUMN crash_context VARCHAR(10000) NOT NULL;

View File

@ -642,7 +642,7 @@ class ApiUsersController < ApiController
# This should largely be moved into a library somewhere in jam-ruby.
def crash_dump
# example of using curl to access this API:
# curl -L -T some_file -X PUT http://localhost:3000/api/dumps?client_type=[MacOSX/Win32/JamBox]&client_version=[VERSION]&client_id=[CLIENT_ID]&session_id=[SESSION_ID]&timestamp=[TIMESTAMP]
# curl -L -T some_file -X PUT http://localhost:3000/api/dumps?client_type=[MacOSX/Win32/JamBox]&client_version=[VERSION]&client_id=[CLIENT_ID]&session_id=[SESSION_ID]&timestamp=[TIMESTAMP]&fsize=10K&crash_context="Blahblahblab"
# user_id is deduced if possible from the user's cookie.
@dump = CrashDump.new
@ -655,8 +655,8 @@ class ApiUsersController < ApiController
@dump.session_id = params[:session_id]
@dump.timestamp = params[:timestamp]
@dump.description = params[:description]
#@dump.fsize = params[:fsize]
#@crash.context = params[:]
@dump.fsize = params[:fsize]
@dump.crash_context = params[:crash_context]
crash_date = params[:crash_date]
unless @dump.save
@ -692,7 +692,8 @@ class ApiUsersController < ApiController
body << "Download at: #{read_url}\n"
body << "User admin url: #{user.admin_url}\n"
body << "Actual Crash Date: #{crash_date}\n"
#body << "File size: #{@dump.fsize}\n"
body << "File size: #{@dump.fsize}\n"
body << "Crash Context:\n\n#{@dump.crash_context}\n"
subject = "Crash for #{@dump.client_type} - #{user.email}, on #{crash_date}"
else
@ -701,7 +702,8 @@ class ApiUsersController < ApiController
body << "Client version: #{@dump.client_version}\n"
body << "Download at: #{read_url}\n"
body << "Actual Crash Date: #{crash_date}\n"
#body << "File size: #{@dump.fsize}\n"
body << "File size: #{@dump.fsize}\n"
body << "Crash Context:\n\n#{@dump.crash_context}\n"
subject = "Crash for #{@dump.client_type} - unknown user), on #{crash_date}"
end

View File

@ -269,6 +269,7 @@ ActiveRecord::Schema.define(:version => 0) do
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "client_version", :limit => 100, :null => false
t.string "crash_context", :limit => 10000,:null => false
end
add_index "crash_dumps", ["client_id"], :name => "crash_dumps_client_id_idx"

View File

@ -546,7 +546,8 @@ CREATE TABLE crash_dumps (
uri character varying(1000),
created_at timestamp without time zone DEFAULT now() NOT NULL,
updated_at timestamp without time zone DEFAULT now() NOT NULL,
client_version character varying(100) NOT NULL
client_version character varying(100) NOT NULL,
crash_context character varying(10000) NOT NULL
);