UNPKG

pinpoint-node-agent

Version:
33 lines (25 loc) 587 B
/** * Pinpoint Node.js Agent * Copyright 2020-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) { return this.storage.run(store, callback) } getStore() { return this.storage.getStore() } disable() { this.storage.disable() } enterWith(store) { this.storage.enterWith(store) } } module.exports = AsyncContextLocalStorage