dd-trace 3.13.0 → 3.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dd-trace",
3
- "version": "3.13.0",
3
+ "version": "3.13.1",
4
4
  "description": "Datadog APM tracing client for JavaScript",
5
5
  "main": "index.js",
6
6
  "typings": "index.d.ts",
@@ -85,36 +85,37 @@ const paramsByFileHandleMethods = {
85
85
  writeFile: ['data', 'options'],
86
86
  writev: ['buffers', 'position']
87
87
  }
88
+ const names = ['fs', 'node:fs']
89
+ names.forEach(name => {
90
+ addHook({ name }, fs => {
91
+ const asyncMethods = Object.keys(paramsByMethod)
92
+ const syncMethods = asyncMethods.map(name => `${name}Sync`)
93
+
94
+ massWrap(fs, asyncMethods, createWrapFunction())
95
+ massWrap(fs, syncMethods, createWrapFunction())
96
+ massWrap(fs.promises, asyncMethods, createWrapFunction('promises.'))
97
+
98
+ wrap(fs.realpath, 'native', createWrapFunction('', 'realpath.native'))
99
+ wrap(fs.realpathSync, 'native', createWrapFunction('', 'realpath.native'))
100
+ wrap(fs.promises.realpath, 'native', createWrapFunction('', 'realpath.native'))
101
+
102
+ wrap(fs, 'createReadStream', wrapCreateStream)
103
+ wrap(fs, 'createWriteStream', wrapCreateStream)
104
+ if (fs.Dir) {
105
+ wrap(fs.Dir.prototype, 'close', createWrapFunction('dir.'))
106
+ wrap(fs.Dir.prototype, 'closeSync', createWrapFunction('dir.'))
107
+ wrap(fs.Dir.prototype, 'read', createWrapFunction('dir.'))
108
+ wrap(fs.Dir.prototype, 'readSync', createWrapFunction('dir.'))
109
+ wrap(fs.Dir.prototype, Symbol.asyncIterator, createWrapDirAsyncIterator())
110
+ }
88
111
 
89
- addHook({ name: 'fs' }, fs => {
90
- const asyncMethods = Object.keys(paramsByMethod)
91
- const syncMethods = asyncMethods.map(name => `${name}Sync`)
92
-
93
- massWrap(fs, asyncMethods, createWrapFunction())
94
- massWrap(fs, syncMethods, createWrapFunction())
95
- massWrap(fs.promises, asyncMethods, createWrapFunction('promises.'))
96
-
97
- wrap(fs.realpath, 'native', createWrapFunction('', 'realpath.native'))
98
- wrap(fs.realpathSync, 'native', createWrapFunction('', 'realpath.native'))
99
- wrap(fs.promises.realpath, 'native', createWrapFunction('', 'realpath.native'))
100
-
101
- wrap(fs, 'createReadStream', wrapCreateStream)
102
- wrap(fs, 'createWriteStream', wrapCreateStream)
103
- if (fs.Dir) {
104
- wrap(fs.Dir.prototype, 'close', createWrapFunction('dir.'))
105
- wrap(fs.Dir.prototype, 'closeSync', createWrapFunction('dir.'))
106
- wrap(fs.Dir.prototype, 'read', createWrapFunction('dir.'))
107
- wrap(fs.Dir.prototype, 'readSync', createWrapFunction('dir.'))
108
- wrap(fs.Dir.prototype, Symbol.asyncIterator, createWrapDirAsyncIterator())
109
- }
110
-
111
- wrap(fs, 'unwatchFile', createWatchWrapFunction())
112
- wrap(fs, 'watch', createWatchWrapFunction())
113
- wrap(fs, 'watchFile', createWatchWrapFunction())
112
+ wrap(fs, 'unwatchFile', createWatchWrapFunction())
113
+ wrap(fs, 'watch', createWatchWrapFunction())
114
+ wrap(fs, 'watchFile', createWatchWrapFunction())
114
115
 
115
- return fs
116
+ return fs
117
+ })
116
118
  })
117
-
118
119
  function isFirstMethodReturningFileHandle (original) {
119
120
  return !kHandle && original.name === 'open'
120
121
  }