Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: display artifact upload durations in the console #28226

Merged
merged 30 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
dd1970d
feat: display how long artifacts take to upload
cacieprins Nov 2, 2023
20145cc
adds changelog entry
cacieprins Nov 2, 2023
dc3b643
add PR link to changelog
cacieprins Nov 2, 2023
294e1e5
Merge branch 'develop' into cacie/feat/artifact-upload-duration
cacieprins Nov 2, 2023
6fab807
bump circle cache
cacieprins Nov 2, 2023
1f29082
previous masking was too greedy, made upload duration masking more li…
cacieprins Nov 2, 2023
181ad9e
update snapshots for video compression system tests
cacieprins Nov 2, 2023
c0970ac
Merge branch 'develop' into cacie/feat/artifact-upload-duration
cacieprins Nov 2, 2023
b5fc9d7
Merge branch 'develop' into cacie/feat/artifact-upload-duration
cacieprins Nov 3, 2023
3bb9264
links changelog for upload durations to open issue
cacieprins Nov 3, 2023
5923629
reorder upload result manifest - show duration after filesize instead…
cacieprins Nov 3, 2023
a05d79c
Merge branch 'develop' into cacie/feat/artifact-upload-duration
cacieprins Nov 3, 2023
2e6ff88
update stdout normalization regex to be less applicable across system…
cacieprins Nov 6, 2023
9c8dbe7
maybe better regex for masking
cacieprins Nov 6, 2023
c1c2823
another snapshot attempt
cacieprins Nov 6, 2023
7a49d2a
Merge branch 'develop' into cacie/feat/artifact-upload-duration
cacieprins Nov 6, 2023
5ef0b61
chore: add after:browser:launch node event (#28180)
chrisbreiding Nov 6, 2023
1995d04
test: update mochaEvent snapshots to be auto-generated (#28224)
mschile Nov 6, 2023
79e2dfe
feat: add support for angular 17 (#28152)
jordanpowell88 Nov 7, 2023
279e050
fix: runIfWaitingForDebugger when targets are reloaded after crashing…
ryanthemanuel Nov 7, 2023
1840609
Merge branch 'develop' into cacie/feat/artifact-upload-duration
cacieprins Nov 7, 2023
3ab4da1
Merge branch 'develop' into cacie/feat/artifact-upload-duration
cacieprins Nov 7, 2023
230a6ba
Merge branch 'develop' into cacie/feat/artifact-upload-duration
cacieprins Nov 9, 2023
1c05363
Merge branch 'develop' into cacie/feat/artifact-upload-duration
cacieprins Nov 13, 2023
1ba9a84
Merge branch 'develop' into cacie/feat/artifact-upload-duration
cacieprins Nov 14, 2023
3b2316b
Update cli/CHANGELOG.md
cacieprins Nov 14, 2023
0f88221
update snapshots
cacieprins Nov 14, 2023
30d9d67
Merge branch 'develop' into cacie/feat/artifact-upload-duration
cacieprins Nov 14, 2023
a8a1d04
Merge branch 'develop' into cacie/feat/artifact-upload-duration
cacieprins Nov 14, 2023
74fa6d6
Update CHANGELOG.md
cacieprins Nov 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/cache-version.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Bump this version to force CI to re-create the cache from scratch.

10-25-23.1
11-2-23
8 changes: 8 additions & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<!-- See the ../guides/writing-the-cypress-changelog.md for details on writing the changelog. -->
## 13.6.0

_Released 11/21/2023 (PENDING)_

**Features:**

- When artifacts are uploaded to the Cypress Cloud, the duration of each upload will be displayed in the console. Addresses [#28237](https://github.com/cypress-io/cypress/issues/28237).

## 13.5.1

_Released 11/14/2023_
Expand Down
10 changes: 9 additions & 1 deletion packages/server/lib/modes/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const { printPendingArtifactUpload, printCompletedArtifactUpload } = require('..
const testsUtils = require('../util/tests_utils')
const specWriter = require('../util/spec_writer')
const { fs } = require('../util/fs')
const { performance } = require('perf_hooks')

// dont yell about any errors either
const runningInternalTests = () => {
Expand Down Expand Up @@ -252,6 +253,8 @@ const uploadArtifactBatch = async (artifacts, protocolManager, quiet) => {
}
}

const startTime = performance.now()

debug('uploading artifact %O', {
...artifact,
payload: typeof artifact.payload,
Expand All @@ -267,6 +270,7 @@ const uploadArtifactBatch = async (artifacts, protocolManager, quiet) => {
url: artifact.uploadUrl,
fileSize: artifact.fileSize,
key: artifact.reportKey,
duration: performance.now() - startTime,
}
}

Expand All @@ -279,6 +283,7 @@ const uploadArtifactBatch = async (artifacts, protocolManager, quiet) => {
pathToFile: artifact.filePath,
fileSize: artifact.fileSize,
key: artifact.reportKey,
duration: performance.now() - startTime,
}
} catch (err) {
debug('failed to upload artifact %o', {
Expand All @@ -297,6 +302,7 @@ const uploadArtifactBatch = async (artifacts, protocolManager, quiet) => {
allErrors: err.errors,
url: artifact.uploadUrl,
pathToFile: artifact.filePath,
duration: performance.now() - startTime,
}
}

Expand All @@ -306,6 +312,7 @@ const uploadArtifactBatch = async (artifacts, protocolManager, quiet) => {
error: err.message,
url: artifact.uploadUrl,
pathToFile: artifact.filePath,
duration: performance.now() - startTime,
}
}
}),
Expand Down Expand Up @@ -338,7 +345,8 @@ const uploadArtifactBatch = async (artifacts, protocolManager, quiet) => {
return skipped && !report.error ? acc : {
...acc,
[key]: {
...report,
// TODO: once cloud supports reporting duration, no longer omit this
..._.omit(report, 'duration'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the Cloud not able to handle extra fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it will give zod errors.

error,
},
}
Expand Down
4 changes: 2 additions & 2 deletions packages/server/lib/util/human_time.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const long = (ms, alwaysIncludeSeconds = true) => {
return msg.join(', ')
}

const short = (ms) => {
const short = (ms, fixed = undefined) => {
let { mins, duration } = parse(ms)
const msg = []

Expand All @@ -53,7 +53,7 @@ const short = (ms) => {
msg.push(`${secs}s`)
} else {
if (!mins) {
const millis = duration.milliseconds()
const millis = fixed ? duration.milliseconds().toFixed(fixed) : duration.milliseconds()

if (millis) {
msg.push(`${millis}ms`)
Expand Down
17 changes: 13 additions & 4 deletions packages/server/lib/util/print-run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -614,21 +614,30 @@ type ArtifactUploadResultLike = {
success: boolean
error?: string
skipped?: boolean
duration?: number
}

export const printCompletedArtifactUpload = <T extends ArtifactUploadResultLike> (artifactUploadResult: T, labels: Record<'protocol' | 'screenshots' | 'video', string>, num: string): void => {
const { pathToFile, key, fileSize, success, error, skipped } = artifactUploadResult
const { pathToFile, key, fileSize, success, error, skipped, duration } = artifactUploadResult

process.stdout.write(` - ${labels[key]} `)

if (success) {
process.stdout.write(`- Done Uploading ${formatFileSize(Number(fileSize))} ${num}`)
process.stdout.write(`- Done Uploading ${formatFileSize(Number(fileSize))}`)
} else if (skipped) {
process.stdout.write(`- Nothing to Upload ${num}`)
process.stdout.write(`- Nothing to Upload`)
} else {
process.stdout.write(`- Failed Uploading ${num}`)
process.stdout.write(`- Failed Uploading`)
}

if (duration) {
const durationOut = humanTime.short(duration, 2)

process.stdout.write(` ${success ? 'in' : 'after'} ${durationOut}`)
}

process.stdout.write(` ${num}`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is num in this context?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1/2, 2/2, etc. carryover name from previous logic


if (pathToFile && key !== 'protocol') {
process.stdout.write(` ${formatPath(pathToFile, undefined, 'cyan')}`)
}
Expand Down
Loading
Loading