-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "feat(node): Rework ANR to use worker script via an integration (
- Loading branch information
Showing
25 changed files
with
900 additions
and
606 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
29 changes: 16 additions & 13 deletions
29
packages/node-integration-tests/suites/anr/basic-session.js
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 |
---|---|---|
@@ -1,28 +1,31 @@ | ||
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(); | ||
}, 10000); | ||
}, 5000); | ||
|
||
Sentry.init({ | ||
dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
release: '1.0', | ||
debug: true, | ||
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 200 })], | ||
transport, | ||
}); | ||
|
||
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); | ||
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'); | ||
} | ||
} | ||
} | ||
|
||
setTimeout(() => { | ||
longWork(); | ||
}, 1000); | ||
setTimeout(() => { | ||
longWork(); | ||
}, 1000); | ||
}); |
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 |
---|---|---|
@@ -1,29 +1,32 @@ | ||
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(); | ||
}, 10000); | ||
}, 5000); | ||
|
||
Sentry.init({ | ||
dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
release: '1.0', | ||
debug: true, | ||
autoSessionTracking: false, | ||
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 200 })], | ||
transport, | ||
}); | ||
|
||
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); | ||
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'); | ||
} | ||
} | ||
} | ||
|
||
setTimeout(() => { | ||
longWork(); | ||
}, 1000); | ||
setTimeout(() => { | ||
longWork(); | ||
}, 1000); | ||
}); |
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 |
---|---|---|
@@ -1,29 +1,32 @@ | ||
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(); | ||
}, 10000); | ||
}, 5000); | ||
|
||
Sentry.init({ | ||
dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
release: '1.0', | ||
debug: true, | ||
autoSessionTracking: false, | ||
integrations: [new Sentry.Integrations.Anr({ captureStackTrace: true, anrThreshold: 200 })], | ||
transport, | ||
}); | ||
|
||
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); | ||
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'); | ||
} | ||
} | ||
} | ||
|
||
setTimeout(() => { | ||
longWork(); | ||
}, 1000); | ||
setTimeout(() => { | ||
longWork(); | ||
}, 1000); | ||
}); |
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
packages/node-integration-tests/suites/anr/test-transport.js
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,17 @@ | ||
const { TextEncoder, TextDecoder } = require('util'); | ||
|
||
const { createTransport } = require('@sentry/core'); | ||
const { parseEnvelope } = require('@sentry/utils'); | ||
|
||
const textEncoder = new TextEncoder(); | ||
const textDecoder = new TextDecoder(); | ||
|
||
// A transport that just logs the envelope payloads to console for checking in tests | ||
exports.transport = () => { | ||
return createTransport({ recordDroppedEvent: () => {}, textEncoder }, async request => { | ||
const env = parseEnvelope(request.body, textEncoder, textDecoder); | ||
// eslint-disable-next-line no-console | ||
console.log(JSON.stringify(env[1][0][1])); | ||
return { statusCode: 200 }; | ||
}); | ||
}; |
Oops, something went wrong.