-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add open telemetry to cypress to allow us to monitor the perfo…
…rmance of the app overtime (#26305) * initial commit, a kinda working prototype * Ready to test in CI * "SyntaxError: Cannot use import statement outside a module" I blame VS code for always inserting the wrong dependency * try using built js instead of the ts file * typescript fixes? * get version correctly, don't use optional chaining in child process. * trying this, idk * try running telemetry for driver-integration-tests-chrome * fix missing spans, add more attributes for some spans * fix missing spans and add suite spans * types * Remove un-used require * remove spans for describe blocks in favor of the full title for tests * migrate to sync resource discovery, start new custom exporters for spans * encrypted * localhost * don't do things on child process * latest changes * update server start span time / add v8 snapshot span & update command span names * prepare for sync * don't send blank key * make telemetry work again for sending directly to honeycomb * web-socket exporter * Add in IPC exporter and message the child process before disconnecting * Use the cloud api by default * move cloud span exporter into telemetry package * shutdown fixes * fix enabled * improve types * run in ci * yml is the worst * type! * add spans for timing insights for visible areas of improvement * type errors * lets try sending data to staging * types * types again * remove problematic attributes * clean up exporters * i like this better even though it doesn't seem to matter much * some self review cleanup * Update comment * add debug messages * mocha tests * actually exit with the right code... oops * simple mistake... have to look into how to fix with ts... * try this i guess * don't return undefined * read me diagram * color? * no rect * moar diagram * docs! * formatting * build more binaries * Supposedly fix cypress in cypress test failures * test 'fixes' * try this instead * do not transpile cypress packages dir * lets try escaping our regex string * Add some diagnostics to help test the built binary.... * try a more complex solution * fix tests probably * just ignore the specific file * fix unit tests * cr updates * Apply suggestions from code review Co-authored-by: Matt Schile <mschile@cypress.io> Co-authored-by: Bill Glesias <bglesias@gmail.com> * Pr updates * don't change the command queue * move encoding and decoding telemetry context for ipc to the telemetry package * build darn it * plead for mercy from the testing gods, i merely wished to have named test reports, but clearly i have overreached. * pr updates, send record key * pr review * optional chaining fails tests * Apply suggestions from code review Co-authored-by: Bill Glesias <bglesias@gmail.com> * tests for cloud-span-exporter * bad merge * adding tests for the remaining exporters * note * docs * Correctly set test under the current run span for component testing * gate sending the message. * pr updates * finally, fingers crossed. --------- Co-authored-by: Emily Rohrbough <emilyrohrbough@yahoo.com> Co-authored-by: Matt Schile <mschile@cypress.io> Co-authored-by: Bill Glesias <bglesias@gmail.com>
- Loading branch information
1 parent
3aa1c48
commit 62f58e0
Showing
54 changed files
with
3,947 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { telemetry } from '@packages/telemetry/src/browser' | ||
|
||
export const addTelemetryListeners = (Cypress) => { | ||
Cypress.on('test:before:run', (attributes, test) => { | ||
// we emit the 'test:before:run' events within various driver tests | ||
try { | ||
// If a span for a previous test hasn't been ended, end it before starting the new test span | ||
const previousTestSpan = telemetry.findActiveSpan((span) => { | ||
return span.name.startsWith('test:') | ||
}) | ||
|
||
if (previousTestSpan) { | ||
telemetry.endActiveSpanAndChildren(previousTestSpan) | ||
} | ||
|
||
const span = telemetry.startSpan({ name: `test:${test.fullTitle()}`, active: true }) | ||
|
||
span?.setAttributes({ | ||
currentRetry: attributes.currentRetry, | ||
}) | ||
} catch (error) { | ||
// TODO: log error when client side debug logging is available | ||
} | ||
}) | ||
|
||
Cypress.on('test:after:run', (attributes, test) => { | ||
try { | ||
const span = telemetry.getSpan(`test:${test.fullTitle()}`) | ||
|
||
span?.setAttributes({ | ||
timings: JSON.stringify(attributes.timings), | ||
}) | ||
|
||
span?.end() | ||
} catch (error) { | ||
// TODO: log error when client side debug logging is available | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
62f58e0
There was a problem hiding this comment.
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 arm64
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:
62f58e0
There was a problem hiding this comment.
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:
62f58e0
There was a problem hiding this comment.
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 arm64
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:
62f58e0
There was a problem hiding this comment.
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:
62f58e0
There was a problem hiding this comment.
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: