forked from pinpoint-apm/pinpoint-node-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pinpoint-apm#140] Support AsyncLocalStorage [email protected]
* Rename refactoring MethodDescriptor2 to MethodDescriptor * AsyncLocalStorage above [email protected] The AsyncHook has been deprecated. Node Document recommend AsyncLocalStorage.
- Loading branch information
Showing
32 changed files
with
1,257 additions
and
1,254 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 was deleted.
Oops, something went wrong.
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: 29 additions & 0 deletions
29
lib/instrumentation/context/async-context-local-storage.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,29 @@ | ||
/** | ||
* Pinpoint Node.js Agent | ||
* Copyright 2023-present NAVER Corp. | ||
* Apache License v2.0 | ||
*/ | ||
|
||
'use strict' | ||
|
||
const { AsyncLocalStorage } = require('node:async_hooks') | ||
|
||
class AsyncContextLocalStorage { | ||
constructor() { | ||
this.storage = new AsyncLocalStorage() | ||
} | ||
|
||
run(store, callback) { | ||
this.storage.run(store, callback) | ||
} | ||
|
||
getStore() { | ||
return this.storage.getStore() | ||
} | ||
|
||
disable() { | ||
this.storage.disable() | ||
} | ||
} | ||
|
||
module.exports = AsyncContextLocalStorage |
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,30 @@ | ||
/** | ||
* Pinpoint Node.js Agent | ||
* Copyright 2023-present NAVER Corp. | ||
* Apache License v2.0 | ||
*/ | ||
|
||
'use strict' | ||
|
||
const contextManager = require('../../context/context-manager') | ||
|
||
class AsyncHooksLocalStorage { | ||
constructor() { | ||
contextManager.start() | ||
} | ||
|
||
run(store, callback) { | ||
contextManager.setObject(store) | ||
callback() | ||
} | ||
|
||
getStore() { | ||
return contextManager.getObject() | ||
} | ||
|
||
disable() { | ||
contextManager.disable() | ||
} | ||
} | ||
|
||
module.exports = AsyncHooksLocalStorage |
Oops, something went wrong.