Skip to content

Commit

Permalink
chore: add telemetry span around collecting garbage (#27259)
Browse files Browse the repository at this point in the history
* chore: add telemetry span around collecting garbage

* Apply suggestions from code review

Co-authored-by: Bill Glesias <bglesias@gmail.com>

* Apply suggestions from code review

Co-authored-by: Matt Schile <mschile@cypress.io>

---------

Co-authored-by: Bill Glesias <bglesias@gmail.com>
Co-authored-by: Matt Schile <mschile@cypress.io>
  • Loading branch information
3 people authored Jul 13, 2023
1 parent 78ad0d5 commit 1fcdc87
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/server/lib/browsers/memory/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import path from 'path'
import pid from 'pidusage'
import { groupCyProcesses, Process } from '../../util/process_profiler'
import browsers from '..'
import { telemetry } from '@packages/telemetry/src/browser'

import type { Automation } from '../../automation'
import type { BrowserInstance } from '../types'
Expand Down Expand Up @@ -274,10 +275,15 @@ const checkMemoryPressureAndLog = async ({ automation, test }: { automation: Aut
const checkMemoryPressure: (automation: Automation) => Promise<void> = measure(async (automation: Automation) => {
if (collectGarbageOnNextTest) {
debug('forcing garbage collection')
let span

try {
span = telemetry.startSpan({ name: 'checkMemoryPressure:collect:garbage' })
await automation.request('collect:garbage', null, null)
} catch (err) {
debug('error collecting garbage: %o', err)
} finally {
span?.end()
}
} else {
debug('skipping garbage collection')
Expand Down

4 comments on commit 1fcdc87

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 1fcdc87 Jul 13, 2023

Choose a reason for hiding this comment

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

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.17.2/linux-x64/develop-1fcdc878b601d1eee870e30ee012993443d61742/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 1fcdc87 Jul 13, 2023

Choose a reason for hiding this comment

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

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.17.2/darwin-x64/develop-1fcdc878b601d1eee870e30ee012993443d61742/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 1fcdc87 Jul 13, 2023

Choose a reason for hiding this comment

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

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.17.2/darwin-x64/develop-1fcdc878b601d1eee870e30ee012993443d61742/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 1fcdc87 Jul 13, 2023

Choose a reason for hiding this comment

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

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/12.17.2/win32-x64/develop-1fcdc878b601d1eee870e30ee012993443d61742/cypress.tgz

Please sign in to comment.