-
Notifications
You must be signed in to change notification settings - Fork 312
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
Scope manager and exporter integration tests #1224
Changes from all commits
d720dd3
64c0cc5
54e1050
938eba1
212717c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ const semver = require('semver') | |
const emitter = new EventEmitter() | ||
|
||
const hasSupportedAsyncLocalStorage = semver.satisfies(process.versions.node, '>=14.5 || ^12.19.0') | ||
const hasSupportedAsyncResource = semver.satisfies(process.versions.node, '>= 14 || ^13.9.0 || ^12.19.0') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't these be the exact same versions as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, because executionAsyncResource was added before AsyncLocalStorage was. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not really about when it was added, but more about when the bugs affecting us were fixed, which was in nodejs/node#33801 which affected both |
||
|
||
const platform = { | ||
_config: {}, | ||
|
@@ -42,9 +43,9 @@ const platform = { | |
off: emitter.removeListener.bind(emitter), | ||
Loader, | ||
getScope (scope) { | ||
if (scope === scopes.ASYNC_RESOURCE) { | ||
if (hasSupportedAsyncResource && scope === scopes.ASYNC_RESOURCE) { | ||
return require('../../scope/async_resource') | ||
} else if (scope === scopes.ASYNC_LOCAL_STORAGE || (!scope && hasSupportedAsyncLocalStorage)) { | ||
} else if (hasSupportedAsyncLocalStorage && (scope === scopes.ASYNC_LOCAL_STORAGE || !scope)) { | ||
return require('../../scope/async_local_storage') | ||
} else { | ||
return require('../../scope/async_hooks') | ||
|
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.
The plugin attaches the span to the request object and doesn't use the scope manager, so this doesn't actually end up testing it.
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.
Would adding a tag to the active span suffice here then?
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.
What is this actually testing? If it's testing the scope manager maybe it should just be used directly.