-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(node): Rework ANR to use worker script via an integration #9823
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
Merged
AbhiPrasad
merged 30 commits into
getsentry:develop
from
timfish:anr-worker-from-base64-script
Dec 19, 2023
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
ed4a316
feat(node): Use worker thread for ANR detection
timfish 14fe3a5
Remove utility
timfish e5c82dd
PR feedback
timfish d246581
Merge branch 'develop' into fix/anr-worker-thread
timfish dce3684
remove outdated comments
timfish 2ca69ca
Merge remote-tracking branch 'origin/fix/anr-worker-thread' into fix/…
timfish 3042553
use getWorkerThreads
timfish dad68a1
Merge branch 'develop' into fix/anr-worker-thread
timfish 61dd30f
Merge branch 'develop' into fix/anr-worker-thread
timfish 33e1ce0
feat(node): Rework ANR to use worker script via an integration
timfish 97b09bb
Bodge the build and add platform
timfish b2a1907
also build before test
timfish 8b6289f
Work on build
timfish 0486f12
Merge branch 'develop' into anr-worker-from-base64-script
timfish 91c19b9
Only node 16 😢
timfish 26b4ebe
Merge remote-tracking branch 'origin/anr-worker-from-base64-script' i…
timfish d098a53
a few worker simplifications
timfish 27ebe02
PR review comments
timfish 624f097
Merge remote-tracking branch 'upstream/develop' into anr-worker-from-…
timfish 94af9ec
Only test node >= 16
timfish 40f25d2
Include and test the old deprecated API
timfish 7ef8050
Merge branch 'develop' into anr-worker-from-base64-script
timfish 0c71dcc
Linting
timfish 930969b
Merge remote-tracking branch 'origin/anr-worker-from-base64-script' i…
timfish 3de4144
Merge remote-tracking branch 'upstream/develop' into anr-worker-from-…
timfish b2d4b66
Merge remote-tracking branch 'upstream/develop' into anr-worker-from-…
timfish f0ac67e
remove isAnrChildProcess usage
timfish 41cc61d
Include `parentSpanId` in trace context
timfish 4a7c4fc
Ensure we get app/device/os/culture context with ANR events
timfish 6271c85
Fix test
timfish File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
29 changes: 13 additions & 16 deletions
29
packages/node-integration-tests/suites/anr/basic-session.js
This file contains hidden or 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 |
---|---|---|
@@ -1,31 +1,28 @@ | ||
const crypto = require('crypto'); | ||
const assert = require('assert'); | ||
|
||
const Sentry = require('@sentry/node'); | ||
|
||
const { transport } = require('./test-transport.js'); | ||
|
||
// close both processes after 5 seconds | ||
setTimeout(() => { | ||
process.exit(); | ||
}, 5000); | ||
}, 10000); | ||
|
||
Sentry.init({ | ||
dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
release: '1.0', | ||
debug: true, | ||
transport, | ||
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 200 })], | ||
}); | ||
|
||
Sentry.enableAnrDetection({ captureStackTrace: true, anrThreshold: 200 }).then(() => { | ||
function longWork() { | ||
for (let i = 0; i < 100; i++) { | ||
const salt = crypto.randomBytes(128).toString('base64'); | ||
// eslint-disable-next-line no-unused-vars | ||
const hash = crypto.pbkdf2Sync('myPassword', salt, 10000, 512, 'sha512'); | ||
} | ||
function longWork() { | ||
for (let i = 0; i < 100; i++) { | ||
const salt = crypto.randomBytes(128).toString('base64'); | ||
// eslint-disable-next-line no-unused-vars | ||
const hash = crypto.pbkdf2Sync('myPassword', salt, 10000, 512, 'sha512'); | ||
assert.ok(hash); | ||
} | ||
} | ||
|
||
setTimeout(() => { | ||
longWork(); | ||
}, 1000); | ||
}); | ||
setTimeout(() => { | ||
longWork(); | ||
}, 1000); |
This file contains hidden or 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 |
---|---|---|
@@ -1,32 +1,29 @@ | ||
const crypto = require('crypto'); | ||
const assert = require('assert'); | ||
|
||
const Sentry = require('@sentry/node'); | ||
|
||
const { transport } = require('./test-transport.js'); | ||
|
||
// close both processes after 5 seconds | ||
setTimeout(() => { | ||
process.exit(); | ||
}, 5000); | ||
}, 10000); | ||
|
||
Sentry.init({ | ||
dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
release: '1.0', | ||
debug: true, | ||
autoSessionTracking: false, | ||
transport, | ||
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 200 })], | ||
}); | ||
|
||
Sentry.enableAnrDetection({ captureStackTrace: true, anrThreshold: 200 }).then(() => { | ||
function longWork() { | ||
for (let i = 0; i < 100; i++) { | ||
const salt = crypto.randomBytes(128).toString('base64'); | ||
// eslint-disable-next-line no-unused-vars | ||
const hash = crypto.pbkdf2Sync('myPassword', salt, 10000, 512, 'sha512'); | ||
} | ||
function longWork() { | ||
for (let i = 0; i < 100; i++) { | ||
const salt = crypto.randomBytes(128).toString('base64'); | ||
// eslint-disable-next-line no-unused-vars | ||
const hash = crypto.pbkdf2Sync('myPassword', salt, 10000, 512, 'sha512'); | ||
assert.ok(hash); | ||
} | ||
} | ||
|
||
setTimeout(() => { | ||
longWork(); | ||
}, 1000); | ||
}); | ||
setTimeout(() => { | ||
longWork(); | ||
}, 1000); |
This file contains hidden or 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 hidden or 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 |
---|---|---|
@@ -1,32 +1,29 @@ | ||
const crypto = require('crypto'); | ||
const assert = require('assert'); | ||
|
||
const Sentry = require('@sentry/node'); | ||
|
||
const { transport } = require('./test-transport.js'); | ||
|
||
// close both processes after 5 seconds | ||
setTimeout(() => { | ||
process.exit(); | ||
}, 5000); | ||
}, 10000); | ||
|
||
Sentry.init({ | ||
dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
release: '1.0', | ||
debug: true, | ||
autoSessionTracking: false, | ||
transport, | ||
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 200 })], | ||
}); | ||
|
||
Sentry.enableAnrDetection({ captureStackTrace: true, anrThreshold: 200 }).then(() => { | ||
function longWork() { | ||
for (let i = 0; i < 100; i++) { | ||
const salt = crypto.randomBytes(128).toString('base64'); | ||
// eslint-disable-next-line no-unused-vars | ||
const hash = crypto.pbkdf2Sync('myPassword', salt, 10000, 512, 'sha512'); | ||
} | ||
function longWork() { | ||
for (let i = 0; i < 100; i++) { | ||
const salt = crypto.randomBytes(128).toString('base64'); | ||
// eslint-disable-next-line no-unused-vars | ||
const hash = crypto.pbkdf2Sync('myPassword', salt, 10000, 512, 'sha512'); | ||
assert.ok(hash); | ||
} | ||
} | ||
|
||
setTimeout(() => { | ||
longWork(); | ||
}, 1000); | ||
}); | ||
setTimeout(() => { | ||
longWork(); | ||
}, 1000); |
This file contains hidden or 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,31 @@ | ||
const crypto = require('crypto'); | ||
const assert = require('assert'); | ||
|
||
const Sentry = require('@sentry/node'); | ||
|
||
setTimeout(() => { | ||
process.exit(); | ||
}, 10000); | ||
|
||
Sentry.init({ | ||
dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
release: '1.0', | ||
debug: true, | ||
autoSessionTracking: false, | ||
}); | ||
|
||
// eslint-disable-next-line deprecation/deprecation | ||
Sentry.enableAnrDetection({ captureStackTrace: true, anrThreshold: 200 }).then(() => { | ||
function longWork() { | ||
for (let i = 0; i < 100; i++) { | ||
const salt = crypto.randomBytes(128).toString('base64'); | ||
// eslint-disable-next-line no-unused-vars | ||
const hash = crypto.pbkdf2Sync('myPassword', salt, 10000, 512, 'sha512'); | ||
assert.ok(hash); | ||
} | ||
} | ||
|
||
setTimeout(() => { | ||
longWork(); | ||
}, 1000); | ||
}); |
17 changes: 0 additions & 17 deletions
17
packages/node-integration-tests/suites/anr/test-transport.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.