@recordreplay/recordings-cli
Advanced tools
Comparing version 0.9.0 to 0.10.0
{ | ||
"name": "@recordreplay/recordings-cli", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"description": "CLI tool for uploading and managing recordings", | ||
@@ -5,0 +5,0 @@ "bin": { |
@@ -37,2 +37,3 @@ # recordings-cli | ||
* `crashed`: The recording process crashed before finishing. | ||
* `crashUploaded`: The recording process crashed and the crash data was uploaded to the record/replay web service for analysis. | ||
@@ -39,0 +40,0 @@ Depending on the status the recording descriptor can have some of the following additional properties: |
@@ -9,2 +9,3 @@ const fs = require("fs"); | ||
connectionUploadRecording, | ||
connectionReportCrash, | ||
closeConnection, | ||
@@ -153,2 +154,21 @@ setRecordingMetadata, | ||
} | ||
case "crashData": { | ||
const { id, data } = obj; | ||
const recording = recordings.find((r) => r.id == id); | ||
if (recording) { | ||
if (!recording.crashData) { | ||
recording.crashData = []; | ||
} | ||
recording.crashData.push(data); | ||
} | ||
break; | ||
} | ||
case "crashUploaded": { | ||
const { id } = obj; | ||
const recording = recordings.find((r) => r.id == id); | ||
if (recording) { | ||
updateStatus(recording, "crashUploaded"); | ||
} | ||
break; | ||
} | ||
} | ||
@@ -172,4 +192,7 @@ } | ||
function updateStatus(recording, status) { | ||
// Once a recording enters an unusable or crashed status, don't change it. | ||
if (recording.status == "unusable" || recording.status == "crashed") { | ||
// Once a recording enters an unusable or crashed status, don't change it | ||
// except to mark crashes as uploaded. | ||
if (recording.status == "unusable" || | ||
recording.status == "crashUploaded" || | ||
(recording.status == "crashed" && status != "crashUploaded")) { | ||
return; | ||
@@ -183,3 +206,3 @@ } | ||
// Remove properties we only use internally. | ||
return { ...recording, buildId: undefined }; | ||
return { ...recording, buildId: undefined, crashData: undefined }; | ||
} | ||
@@ -194,6 +217,13 @@ | ||
function uploadSkipReason(recording) { | ||
if (!["onDisk", "startedWrite", "startedUpload"].includes(recording.status)) { | ||
// Status values where there is something worth uploading. | ||
const canUploadStatus = [ | ||
"onDisk", | ||
"startedWrite", | ||
"startedUpload", | ||
"crashed", | ||
]; | ||
if (!canUploadStatus.includes(recording.status)) { | ||
return `wrong recording status ${recording.status}`; | ||
} | ||
if (!recording.path) { | ||
if (!recording.path && recording.status != "crashed") { | ||
return "recording not saved to disk"; | ||
@@ -225,2 +255,16 @@ } | ||
async function doUploadCrash(dir, server, recording, verbose, apiKey) { | ||
maybeLog(verbose, `Starting crash data upload for ${recording.id}...`); | ||
if (!(await initConnection(server, apiKey, verbose))) { | ||
maybeLog(verbose, `Crash data upload failed: can't connect to server ${server}`); | ||
return null; | ||
} | ||
await Promise.all((recording.crashData || []).map(async data => { | ||
await connectionReportCrash(data); | ||
})); | ||
addRecordingEvent(dir, "crashUploaded", recording.id, { server }); | ||
maybeLog(verbose, `Crash data upload finished.`); | ||
closeConnection(); | ||
} | ||
async function doUploadRecording(dir, server, recording, verbose, apiKey) { | ||
@@ -237,2 +281,7 @@ maybeLog(verbose, `Starting upload for ${recording.id}...`); | ||
} | ||
if (recording.status == "crashed") { | ||
await doUploadCrash(dir, server, recording, verbose, apiKey); | ||
maybeLog(verbose, `Upload failed: crashed while recording`); | ||
return null; | ||
} | ||
let contents; | ||
@@ -239,0 +288,0 @@ try { |
@@ -87,2 +87,6 @@ const ProtocolClient = require("./client"); | ||
async function connectionReportCrash(data) { | ||
await gClient.sendCommand("Internal.reportCrash", { data }); | ||
} | ||
// Granularity for splitting up a recording into chunks for uploading. | ||
@@ -126,4 +130,5 @@ const ChunkGranularity = 1024 * 1024; | ||
connectionUploadRecording, | ||
connectionReportCrash, | ||
closeConnection, | ||
setRecordingMetadata, | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36791
956
131