@sentry/node 10.59.0 → 10.61.0
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/build/cjs/index.js +3 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/integrations/fs/index.js +8 -17
- package/build/cjs/integrations/fs/index.js.map +1 -1
- package/build/cjs/integrations/fs/vendored/instrumentation.js +110 -161
- package/build/cjs/integrations/fs/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/node-fetch/index.js +7 -8
- package/build/cjs/integrations/node-fetch/index.js.map +1 -1
- package/build/cjs/integrations/node-fetch/vendored/semconv.js +28 -0
- package/build/cjs/integrations/node-fetch/vendored/semconv.js.map +1 -0
- package/build/cjs/integrations/node-fetch/vendored/undici.js +90 -127
- package/build/cjs/integrations/node-fetch/vendored/undici.js.map +1 -1
- package/build/cjs/integrations/tracing/dataloader/vendored/instrumentation.js +5 -6
- package/build/cjs/integrations/tracing/dataloader/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/index.js +1 -11
- package/build/cjs/integrations/tracing/kafka/index.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/vendored/instrumentation.js +45 -247
- package/build/cjs/integrations/tracing/kafka/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/vendored/semconv.js +4 -8
- package/build/cjs/integrations/tracing/kafka/vendored/semconv.js.map +1 -1
- package/build/cjs/integrations/tracing/kafka/vendored/utils.js +113 -0
- package/build/cjs/integrations/tracing/kafka/vendored/utils.js.map +1 -0
- package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js +1 -2
- package/build/cjs/integrations/tracing/knex/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/mongo/vendored/utils.js +1 -2
- package/build/cjs/integrations/tracing/mongo/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/mongoose/vendored/mongoose.js +1 -2
- package/build/cjs/integrations/tracing/mongoose/vendored/mongoose.js.map +1 -1
- package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js +1 -2
- package/build/cjs/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/vendored/instrumentation.js +2 -3
- package/build/cjs/integrations/tracing/postgres/vendored/instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/postgres/vendored/utils.js +1 -2
- package/build/cjs/integrations/tracing/postgres/vendored/utils.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/index.js +4 -2
- package/build/cjs/integrations/tracing/redis/index.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js +2 -3
- package/build/cjs/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js +3 -4
- package/build/cjs/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -1
- package/build/cjs/integrations/tracing/tedious/vendored/instrumentation.js +1 -2
- package/build/cjs/integrations/tracing/tedious/vendored/instrumentation.js.map +1 -1
- package/build/cjs/sdk/initOtel.js +2 -1
- package/build/cjs/sdk/initOtel.js.map +1 -1
- package/build/esm/index.js +1 -1
- package/build/esm/integrations/fs/index.js +9 -18
- package/build/esm/integrations/fs/index.js.map +1 -1
- package/build/esm/integrations/fs/vendored/instrumentation.js +111 -162
- package/build/esm/integrations/fs/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/node-fetch/index.js +8 -9
- package/build/esm/integrations/node-fetch/index.js.map +1 -1
- package/build/esm/integrations/node-fetch/vendored/semconv.js +15 -0
- package/build/esm/integrations/node-fetch/vendored/semconv.js.map +1 -0
- package/build/esm/integrations/node-fetch/vendored/undici.js +79 -116
- package/build/esm/integrations/node-fetch/vendored/undici.js.map +1 -1
- package/build/esm/integrations/tracing/dataloader/vendored/instrumentation.js +6 -7
- package/build/esm/integrations/tracing/dataloader/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/index.js +2 -12
- package/build/esm/integrations/tracing/kafka/index.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/vendored/instrumentation.js +47 -249
- package/build/esm/integrations/tracing/kafka/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/vendored/semconv.js +3 -5
- package/build/esm/integrations/tracing/kafka/vendored/semconv.js.map +1 -1
- package/build/esm/integrations/tracing/kafka/vendored/utils.js +107 -0
- package/build/esm/integrations/tracing/kafka/vendored/utils.js.map +1 -0
- package/build/esm/integrations/tracing/knex/vendored/instrumentation.js +2 -3
- package/build/esm/integrations/tracing/knex/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/mongo/vendored/utils.js +2 -3
- package/build/esm/integrations/tracing/mongo/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/mongoose/vendored/mongoose.js +2 -3
- package/build/esm/integrations/tracing/mongoose/vendored/mongoose.js.map +1 -1
- package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js +2 -3
- package/build/esm/integrations/tracing/mysql2/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/vendored/instrumentation.js +3 -4
- package/build/esm/integrations/tracing/postgres/vendored/instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/postgres/vendored/utils.js +2 -3
- package/build/esm/integrations/tracing/postgres/vendored/utils.js.map +1 -1
- package/build/esm/integrations/tracing/redis/index.js +4 -2
- package/build/esm/integrations/tracing/redis/index.js.map +1 -1
- package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js +3 -4
- package/build/esm/integrations/tracing/redis/vendored/ioredis-instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js +4 -5
- package/build/esm/integrations/tracing/redis/vendored/redis-instrumentation.js.map +1 -1
- package/build/esm/integrations/tracing/tedious/vendored/instrumentation.js +2 -3
- package/build/esm/integrations/tracing/tedious/vendored/instrumentation.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/build/esm/sdk/initOtel.js +2 -1
- package/build/esm/sdk/initOtel.js.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/integrations/fs/index.d.ts +2 -14
- package/build/types/integrations/fs/index.d.ts.map +1 -1
- package/build/types/integrations/fs/vendored/instrumentation.d.ts +2 -10
- package/build/types/integrations/fs/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/fs/vendored/types.d.ts +1 -2
- package/build/types/integrations/fs/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/node-fetch/index.d.ts.map +1 -1
- package/build/types/integrations/node-fetch/vendored/internal-types.d.ts.map +1 -1
- package/build/types/integrations/node-fetch/vendored/semconv.d.ts +13 -0
- package/build/types/integrations/node-fetch/vendored/semconv.d.ts.map +1 -0
- package/build/types/integrations/node-fetch/vendored/types.d.ts +2 -4
- package/build/types/integrations/node-fetch/vendored/types.d.ts.map +1 -1
- package/build/types/integrations/node-fetch/vendored/undici.d.ts +6 -7
- package/build/types/integrations/node-fetch/vendored/undici.d.ts.map +1 -1
- package/build/types/integrations/tracing/dataloader/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/instrumentation.d.ts +3 -13
- package/build/types/integrations/tracing/kafka/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/kafkajs-types.d.ts +0 -32
- package/build/types/integrations/tracing/kafka/vendored/kafkajs-types.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/semconv.d.ts +9 -28
- package/build/types/integrations/tracing/kafka/vendored/semconv.d.ts.map +1 -1
- package/build/types/integrations/tracing/kafka/vendored/utils.d.ts +29 -0
- package/build/types/integrations/tracing/kafka/vendored/utils.d.ts.map +1 -0
- package/build/types/integrations/tracing/knex/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongo/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/mongoose/vendored/mongoose.d.ts.map +1 -1
- package/build/types/integrations/tracing/mysql2/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/postgres/vendored/utils.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/index.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/vendored/ioredis-instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/redis/vendored/redis-instrumentation.d.ts.map +1 -1
- package/build/types/integrations/tracing/tedious/vendored/instrumentation.d.ts.map +1 -1
- package/build/types/sdk/initOtel.d.ts.map +1 -1
- package/build/types-ts3.8/index.d.ts +1 -1
- package/build/types-ts3.8/integrations/fs/index.d.ts +2 -14
- package/build/types-ts3.8/integrations/fs/vendored/instrumentation.d.ts +2 -10
- package/build/types-ts3.8/integrations/fs/vendored/types.d.ts +1 -2
- package/build/types-ts3.8/integrations/node-fetch/vendored/semconv.d.ts +13 -0
- package/build/types-ts3.8/integrations/node-fetch/vendored/types.d.ts +2 -4
- package/build/types-ts3.8/integrations/node-fetch/vendored/undici.d.ts +6 -7
- package/build/types-ts3.8/integrations/tracing/kafka/vendored/instrumentation.d.ts +3 -13
- package/build/types-ts3.8/integrations/tracing/kafka/vendored/kafkajs-types.d.ts +0 -32
- package/build/types-ts3.8/integrations/tracing/kafka/vendored/semconv.d.ts +9 -28
- package/build/types-ts3.8/integrations/tracing/kafka/vendored/utils.d.ts +29 -0
- package/package.json +5 -6
- package/build/cjs/integrations/tracing/kafka/vendored/internal-types.js +0 -6
- package/build/cjs/integrations/tracing/kafka/vendored/internal-types.js.map +0 -1
- package/build/cjs/integrations/tracing/kafka/vendored/propagator.js +0 -22
- package/build/cjs/integrations/tracing/kafka/vendored/propagator.js.map +0 -1
- package/build/esm/integrations/tracing/kafka/vendored/internal-types.js +0 -4
- package/build/esm/integrations/tracing/kafka/vendored/internal-types.js.map +0 -1
- package/build/esm/integrations/tracing/kafka/vendored/propagator.js +0 -20
- package/build/esm/integrations/tracing/kafka/vendored/propagator.js.map +0 -1
- package/build/types/integrations/tracing/kafka/vendored/internal-types.d.ts +0 -9
- package/build/types/integrations/tracing/kafka/vendored/internal-types.d.ts.map +0 -1
- package/build/types/integrations/tracing/kafka/vendored/propagator.d.ts +0 -3
- package/build/types/integrations/tracing/kafka/vendored/propagator.d.ts.map +0 -1
- package/build/types/integrations/tracing/kafka/vendored/types.d.ts +0 -26
- package/build/types/integrations/tracing/kafka/vendored/types.d.ts.map +0 -1
- package/build/types/integrations/tracing/utils/sql-common.d.ts +0 -3
- package/build/types/integrations/tracing/utils/sql-common.d.ts.map +0 -1
- package/build/types-ts3.8/integrations/tracing/kafka/vendored/internal-types.d.ts +0 -9
- package/build/types-ts3.8/integrations/tracing/kafka/vendored/propagator.d.ts +0 -3
- package/build/types-ts3.8/integrations/tracing/kafka/vendored/types.d.ts +0 -26
- package/build/types-ts3.8/integrations/tracing/utils/sql-common.d.ts +0 -3
package/build/cjs/index.js
CHANGED
|
@@ -110,6 +110,7 @@ exports.Scope = core.Scope;
|
|
|
110
110
|
exports.addBreadcrumb = core.addBreadcrumb;
|
|
111
111
|
exports.addEventProcessor = core.addEventProcessor;
|
|
112
112
|
exports.addIntegration = core.addIntegration;
|
|
113
|
+
exports.bindScopeToEmitter = core.bindScopeToEmitter;
|
|
113
114
|
exports.captureCheckIn = core.captureCheckIn;
|
|
114
115
|
exports.captureConsoleIntegration = core.captureConsoleIntegration;
|
|
115
116
|
exports.captureEvent = core.captureEvent;
|
|
@@ -158,6 +159,8 @@ exports.parameterize = core.parameterize;
|
|
|
158
159
|
exports.profiler = core.profiler;
|
|
159
160
|
exports.requestDataIntegration = core.requestDataIntegration;
|
|
160
161
|
exports.rewriteFramesIntegration = core.rewriteFramesIntegration;
|
|
162
|
+
exports.setAttribute = core.setAttribute;
|
|
163
|
+
exports.setAttributes = core.setAttributes;
|
|
161
164
|
exports.setContext = core.setContext;
|
|
162
165
|
exports.setConversationId = core.setConversationId;
|
|
163
166
|
exports.setCurrentClient = core.setCurrentClient;
|
package/build/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
3
|
const core = require('@sentry/core');
|
|
4
|
-
const nodeCore = require('@sentry/node-core');
|
|
5
4
|
const instrumentation = require('./vendored/instrumentation.js');
|
|
6
5
|
|
|
7
6
|
const INTEGRATION_NAME = "FileSystem";
|
|
8
|
-
const fsIntegration = core.defineIntegration(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
recordFilePaths: options.recordFilePaths,
|
|
17
|
-
recordErrorMessagesAsSpanAttributes: options.recordErrorMessagesAsSpanAttributes
|
|
18
|
-
})
|
|
19
|
-
)();
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
);
|
|
7
|
+
const fsIntegration = core.defineIntegration((options = {}) => {
|
|
8
|
+
return {
|
|
9
|
+
name: INTEGRATION_NAME,
|
|
10
|
+
setupOnce() {
|
|
11
|
+
instrumentation.enableFsInstrumentation(options);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
});
|
|
24
15
|
|
|
25
16
|
exports.fsIntegration = fsIntegration;
|
|
26
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/integrations/fs/index.ts"],"sourcesContent":["import { defineIntegration } from '@sentry/core';\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/integrations/fs/index.ts"],"sourcesContent":["import { defineIntegration } from '@sentry/core';\nimport { enableFsInstrumentation } from './vendored/instrumentation';\nimport type { FsInstrumentationConfig } from './vendored/types';\n\nconst INTEGRATION_NAME = 'FileSystem';\n\n/**\n * This integration will create spans for `fs` API operations, like reading and writing files.\n *\n * **WARNING:** This integration may add significant overhead to your application. Especially in scenarios with a lot of\n * file I/O, like for example when running a framework dev server, including this integration can massively slow down\n * your application.\n *\n * @param options Configuration for this integration.\n */\nexport const fsIntegration = defineIntegration((options: FsInstrumentationConfig = {}) => {\n return {\n name: INTEGRATION_NAME,\n setupOnce() {\n enableFsInstrumentation(options);\n },\n };\n});\n"],"names":["defineIntegration","enableFsInstrumentation"],"mappings":";;;;;AAIA,MAAM,gBAAA,GAAmB,YAAA;AAWlB,MAAM,aAAA,GAAgBA,sBAAA,CAAkB,CAAC,OAAA,GAAmC,EAAC,KAAM;AACxF,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,gBAAA;AAAA,IACN,SAAA,GAAY;AACV,MAAAC,uCAAA,CAAwB,OAAO,CAAA;AAAA,IACjC;AAAA,GACF;AACF,CAAC;;;;"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
-
const api = require('@opentelemetry/api');
|
|
4
|
-
const instrumentation = require('@opentelemetry/instrumentation');
|
|
5
3
|
const core = require('@sentry/core');
|
|
4
|
+
const fs = require('fs');
|
|
6
5
|
const util = require('util');
|
|
7
6
|
const constants = require('./constants.js');
|
|
8
7
|
const utils = require('./utils.js');
|
|
9
8
|
|
|
10
|
-
const PACKAGE_NAME = "@sentry/instrumentation-fs";
|
|
11
9
|
const SPAN_ORIGIN = "auto.file.fs";
|
|
12
10
|
const SPAN_OP = "file";
|
|
13
11
|
const FS_OPERATIONS_WITH_OLD_PATH_NEW_PATH = ["rename", "renameSync"];
|
|
@@ -95,179 +93,130 @@ function getSpanAttributes(functionName, args, config) {
|
|
|
95
93
|
function patchedFunctionWithOriginalProperties(patchedFunction, original) {
|
|
96
94
|
return Object.assign(patchedFunction, original);
|
|
97
95
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
const _patched = /* @__PURE__ */ new WeakMap();
|
|
97
|
+
function _patchMethod(obj, name, wrapper) {
|
|
98
|
+
const original = obj[name];
|
|
99
|
+
if (typeof original !== "function") return;
|
|
100
|
+
let patched = _patched.get(obj);
|
|
101
|
+
if (!patched) {
|
|
102
|
+
patched = /* @__PURE__ */ new Set();
|
|
103
|
+
_patched.set(obj, patched);
|
|
101
104
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (instrumentation.isWrapped(objectToPatch[functionNameToPatch])) {
|
|
111
|
-
this._unwrap(objectToPatch, functionNameToPatch);
|
|
112
|
-
}
|
|
113
|
-
this._wrap(objectToPatch, functionNameToPatch, this._patchSyncFunction.bind(this, fName));
|
|
114
|
-
}
|
|
115
|
-
for (const fName of constants.CALLBACK_FUNCTIONS) {
|
|
116
|
-
const { objectToPatch, functionNameToPatch } = utils.indexFs(fs, fName);
|
|
117
|
-
if (instrumentation.isWrapped(objectToPatch[functionNameToPatch])) {
|
|
118
|
-
this._unwrap(objectToPatch, functionNameToPatch);
|
|
119
|
-
}
|
|
120
|
-
if (fName === "exists") {
|
|
121
|
-
this._wrap(objectToPatch, functionNameToPatch, this._patchExistsCallbackFunction.bind(this, fName));
|
|
122
|
-
continue;
|
|
123
|
-
}
|
|
124
|
-
this._wrap(objectToPatch, functionNameToPatch, this._patchCallbackFunction.bind(this, fName));
|
|
125
|
-
}
|
|
126
|
-
for (const fName of constants.PROMISE_FUNCTIONS) {
|
|
127
|
-
if (instrumentation.isWrapped(fs.promises[fName])) {
|
|
128
|
-
this._unwrap(fs.promises, fName);
|
|
129
|
-
}
|
|
130
|
-
this._wrap(fs.promises, fName, this._patchPromiseFunction.bind(this, fName));
|
|
131
|
-
}
|
|
132
|
-
return fs;
|
|
133
|
-
},
|
|
134
|
-
(fs) => {
|
|
135
|
-
if (fs === void 0) return;
|
|
136
|
-
for (const fName of constants.SYNC_FUNCTIONS) {
|
|
137
|
-
const { objectToPatch, functionNameToPatch } = utils.indexFs(fs, fName);
|
|
138
|
-
if (instrumentation.isWrapped(objectToPatch[functionNameToPatch])) {
|
|
139
|
-
this._unwrap(objectToPatch, functionNameToPatch);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
for (const fName of constants.CALLBACK_FUNCTIONS) {
|
|
143
|
-
const { objectToPatch, functionNameToPatch } = utils.indexFs(fs, fName);
|
|
144
|
-
if (instrumentation.isWrapped(objectToPatch[functionNameToPatch])) {
|
|
145
|
-
this._unwrap(objectToPatch, functionNameToPatch);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
for (const fName of constants.PROMISE_FUNCTIONS) {
|
|
149
|
-
if (instrumentation.isWrapped(fs.promises[fName])) {
|
|
150
|
-
this._unwrap(fs.promises, fName);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
),
|
|
155
|
-
new instrumentation.InstrumentationNodeModuleDefinition(
|
|
156
|
-
"fs/promises",
|
|
157
|
-
["*"],
|
|
158
|
-
(fsPromises) => {
|
|
159
|
-
for (const fName of constants.PROMISE_FUNCTIONS) {
|
|
160
|
-
if (instrumentation.isWrapped(fsPromises[fName])) {
|
|
161
|
-
this._unwrap(fsPromises, fName);
|
|
162
|
-
}
|
|
163
|
-
this._wrap(fsPromises, fName, this._patchPromiseFunction.bind(this, fName));
|
|
164
|
-
}
|
|
165
|
-
return fsPromises;
|
|
166
|
-
},
|
|
167
|
-
(fsPromises) => {
|
|
168
|
-
if (fsPromises === void 0) return;
|
|
169
|
-
for (const fName of constants.PROMISE_FUNCTIONS) {
|
|
170
|
-
if (instrumentation.isWrapped(fsPromises[fName])) {
|
|
171
|
-
this._unwrap(fsPromises, fName);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
)
|
|
176
|
-
];
|
|
177
|
-
}
|
|
178
|
-
_patchSyncFunction(functionName, original) {
|
|
179
|
-
const instrumentation = this;
|
|
180
|
-
const patchedFunction = function(...args) {
|
|
181
|
-
const config = instrumentation.getConfig();
|
|
182
|
-
const attributes = getSpanAttributes(functionName, args, config);
|
|
183
|
-
return core.startSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes }, (span) => {
|
|
184
|
-
try {
|
|
185
|
-
return core.suppressTracing(() => original.apply(this, args));
|
|
186
|
-
} catch (error) {
|
|
187
|
-
recordError(span, error, config);
|
|
188
|
-
throw error;
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
};
|
|
192
|
-
return patchedFunctionWithOriginalProperties(patchedFunction, original);
|
|
193
|
-
}
|
|
194
|
-
_patchCallbackFunction(functionName, original) {
|
|
195
|
-
const instrumentation = this;
|
|
196
|
-
const patchedFunction = function(...args) {
|
|
197
|
-
const config = instrumentation.getConfig();
|
|
198
|
-
const lastIdx = args.length - 1;
|
|
199
|
-
const cb = args[lastIdx];
|
|
200
|
-
if (typeof cb !== "function") {
|
|
201
|
-
return original.apply(this, args);
|
|
202
|
-
}
|
|
203
|
-
const attributes = getSpanAttributes(functionName, args, config);
|
|
204
|
-
const span = core.startInactiveSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes });
|
|
205
|
-
args[lastIdx] = api.context.bind(api.context.active(), function(...cbArgs) {
|
|
206
|
-
const error = cbArgs[0];
|
|
207
|
-
if (error) {
|
|
208
|
-
recordError(span, error, config);
|
|
209
|
-
}
|
|
210
|
-
span.end();
|
|
211
|
-
return cb.apply(this, cbArgs);
|
|
212
|
-
});
|
|
105
|
+
if (patched.has(name)) return;
|
|
106
|
+
patched.add(name);
|
|
107
|
+
obj[name] = wrapper(original);
|
|
108
|
+
}
|
|
109
|
+
function _patchSyncFunction(functionName, original, config) {
|
|
110
|
+
const patchedFunction = function(...args) {
|
|
111
|
+
const attributes = getSpanAttributes(functionName, args, config);
|
|
112
|
+
return core.startSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes }, (span) => {
|
|
213
113
|
try {
|
|
214
114
|
return core.suppressTracing(() => original.apply(this, args));
|
|
215
115
|
} catch (error) {
|
|
216
116
|
recordError(span, error, config);
|
|
217
|
-
span.end();
|
|
218
117
|
throw error;
|
|
219
118
|
}
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
return patchedFunctionWithOriginalProperties(patchedFunction, original);
|
|
122
|
+
}
|
|
123
|
+
function _patchCallbackFunction(functionName, original, config) {
|
|
124
|
+
const patchedFunction = function(...args) {
|
|
125
|
+
const lastIdx = args.length - 1;
|
|
126
|
+
const cb = args[lastIdx];
|
|
127
|
+
if (typeof cb !== "function") {
|
|
128
|
+
return original.apply(this, args);
|
|
129
|
+
}
|
|
130
|
+
const attributes = getSpanAttributes(functionName, args, config);
|
|
131
|
+
const span = core.startInactiveSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes });
|
|
132
|
+
const parentSpan = core.getActiveSpan();
|
|
133
|
+
args[lastIdx] = function(...cbArgs) {
|
|
134
|
+
const error = cbArgs[0];
|
|
135
|
+
if (error) {
|
|
136
|
+
recordError(span, error, config);
|
|
137
|
+
}
|
|
138
|
+
span.end();
|
|
139
|
+
if (parentSpan) {
|
|
140
|
+
return core.withActiveSpan(parentSpan, () => cb.apply(this, cbArgs));
|
|
141
|
+
}
|
|
142
|
+
return cb.apply(this, cbArgs);
|
|
220
143
|
};
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
144
|
+
try {
|
|
145
|
+
return core.suppressTracing(() => original.apply(this, args));
|
|
146
|
+
} catch (error) {
|
|
147
|
+
recordError(span, error, config);
|
|
148
|
+
span.end();
|
|
149
|
+
throw error;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
return patchedFunctionWithOriginalProperties(patchedFunction, original);
|
|
153
|
+
}
|
|
154
|
+
function _patchExistsCallbackFunction(original, config) {
|
|
155
|
+
const functionName = "exists";
|
|
156
|
+
const patchedFunction = function(...args) {
|
|
157
|
+
const lastIdx = args.length - 1;
|
|
158
|
+
const cb = args[lastIdx];
|
|
159
|
+
if (typeof cb !== "function") {
|
|
160
|
+
return original.apply(this, args);
|
|
161
|
+
}
|
|
162
|
+
const attributes = getSpanAttributes(functionName, args, config);
|
|
163
|
+
const span = core.startInactiveSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes });
|
|
164
|
+
const parentSpan = core.getActiveSpan();
|
|
165
|
+
args[lastIdx] = function(...cbArgs) {
|
|
166
|
+
span.end();
|
|
167
|
+
if (parentSpan) {
|
|
168
|
+
return core.withActiveSpan(parentSpan, () => cb.apply(this, cbArgs));
|
|
231
169
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
170
|
+
return cb.apply(this, cbArgs);
|
|
171
|
+
};
|
|
172
|
+
try {
|
|
173
|
+
return core.suppressTracing(() => original.apply(this, args));
|
|
174
|
+
} catch (error) {
|
|
175
|
+
recordError(span, error, config);
|
|
176
|
+
span.end();
|
|
177
|
+
throw error;
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
const functionWithOriginalProperties = patchedFunctionWithOriginalProperties(patchedFunction, original);
|
|
181
|
+
const promisified = function(path) {
|
|
182
|
+
return new Promise((resolve) => functionWithOriginalProperties(path, resolve));
|
|
183
|
+
};
|
|
184
|
+
Object.defineProperty(promisified, "name", { value: functionName });
|
|
185
|
+
Object.defineProperty(functionWithOriginalProperties, util.promisify.custom, {
|
|
186
|
+
value: promisified
|
|
187
|
+
});
|
|
188
|
+
return functionWithOriginalProperties;
|
|
189
|
+
}
|
|
190
|
+
function _patchPromiseFunction(functionName, original, config) {
|
|
191
|
+
const patchedFunction = async function(...args) {
|
|
192
|
+
const attributes = getSpanAttributes(functionName, args, config);
|
|
193
|
+
return core.startSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes }, async (span) => {
|
|
238
194
|
try {
|
|
239
|
-
return core.suppressTracing(() => original.apply(this, args));
|
|
195
|
+
return await core.suppressTracing(() => original.apply(this, args));
|
|
240
196
|
} catch (error) {
|
|
241
197
|
recordError(span, error, config);
|
|
242
|
-
span.end();
|
|
243
198
|
throw error;
|
|
244
199
|
}
|
|
245
|
-
};
|
|
246
|
-
const functionWithOriginalProperties = patchedFunctionWithOriginalProperties(patchedFunction, original);
|
|
247
|
-
const promisified = function(path) {
|
|
248
|
-
return new Promise((resolve) => functionWithOriginalProperties(path, resolve));
|
|
249
|
-
};
|
|
250
|
-
Object.defineProperty(promisified, "name", { value: functionName });
|
|
251
|
-
Object.defineProperty(functionWithOriginalProperties, util.promisify.custom, {
|
|
252
|
-
value: promisified
|
|
253
200
|
});
|
|
254
|
-
|
|
201
|
+
};
|
|
202
|
+
return patchedFunctionWithOriginalProperties(patchedFunction, original);
|
|
203
|
+
}
|
|
204
|
+
function enableFsInstrumentation(config = {}) {
|
|
205
|
+
for (const fName of constants.SYNC_FUNCTIONS) {
|
|
206
|
+
const { objectToPatch, functionNameToPatch } = utils.indexFs(fs, fName);
|
|
207
|
+
_patchMethod(objectToPatch, functionNameToPatch, (original) => _patchSyncFunction(fName, original, config));
|
|
255
208
|
}
|
|
256
|
-
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
};
|
|
270
|
-
return patchedFunctionWithOriginalProperties(patchedFunction, original);
|
|
209
|
+
for (const fName of constants.CALLBACK_FUNCTIONS) {
|
|
210
|
+
const { objectToPatch, functionNameToPatch } = utils.indexFs(fs, fName);
|
|
211
|
+
if (fName === "exists") {
|
|
212
|
+
_patchMethod(objectToPatch, functionNameToPatch, (original) => _patchExistsCallbackFunction(original, config));
|
|
213
|
+
} else {
|
|
214
|
+
_patchMethod(objectToPatch, functionNameToPatch, (original) => _patchCallbackFunction(fName, original, config));
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
const fsPromises = fs.promises;
|
|
218
|
+
for (const fName of constants.PROMISE_FUNCTIONS) {
|
|
219
|
+
_patchMethod(fsPromises, fName, (original) => _patchPromiseFunction(fName, original, config));
|
|
271
220
|
}
|
|
272
221
|
}
|
|
273
222
|
function recordError(span, error, config) {
|
|
@@ -277,5 +226,5 @@ function recordError(span, error, config) {
|
|
|
277
226
|
}
|
|
278
227
|
}
|
|
279
228
|
|
|
280
|
-
exports.
|
|
229
|
+
exports.enableFsInstrumentation = enableFsInstrumentation;
|
|
281
230
|
//# sourceMappingURL=instrumentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sources":["../../../../../src/integrations/fs/vendored/instrumentation.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-fs\n * - Upstream version: @opentelemetry/instrumentation-fs@0.37.0\n * - Minor TypeScript strictness adjustments for this repository's compiler settings\n * - The OpenTelemetry tracer APIs were replaced with Sentry's `startSpan`/`startInactiveSpan`/`suppressTracing`\n * and the configurable `createHook`/`endHook`/`requireParentSpan` options were removed in favor of inlined,\n * Sentry-specific span attributes.\n */\n\nimport { context } from '@opentelemetry/api';\nimport { InstrumentationBase, InstrumentationNodeModuleDefinition, isWrapped } from '@opentelemetry/instrumentation';\nimport type { Span, SpanAttributes } from '@sentry/core';\nimport {\n SDK_VERSION,\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_ERROR,\n startInactiveSpan,\n startSpan,\n suppressTracing,\n} from '@sentry/core';\nimport type * as fs from 'fs';\nimport { promisify } from 'util';\nimport { CALLBACK_FUNCTIONS, PROMISE_FUNCTIONS, SYNC_FUNCTIONS } from './constants';\nimport type { FMember, FPMember, FsInstrumentationConfig, GenericFunction } from './types';\nimport { indexFs } from './utils';\n\ntype FS = typeof fs;\ntype FSPromises = (typeof fs)['promises'];\n\nconst PACKAGE_NAME = '@sentry/instrumentation-fs';\n\nconst SPAN_ORIGIN = 'auto.file.fs';\nconst SPAN_OP = 'file';\n\n// The following lists categorize `fs` functions by the shape of their leading path arguments, so we can\n// record meaningful span attributes for them. These are Sentry-specific additions (not part of upstream).\nconst FS_OPERATIONS_WITH_OLD_PATH_NEW_PATH = ['rename', 'renameSync'];\nconst FS_OPERATIONS_WITH_SRC_DEST = ['copyFile', 'cp', 'copyFileSync', 'cpSync'];\nconst FS_OPERATIONS_WITH_EXISTING_PATH_NEW_PATH = ['link', 'linkSync'];\nconst FS_OPERATIONS_WITH_PREFIX = ['mkdtemp', 'mkdtempSync'];\nconst FS_OPERATIONS_WITH_TARGET_PATH = ['symlink', 'symlinkSync'];\nconst FS_OPERATIONS_WITH_PATH_ARG = [\n 'access',\n 'appendFile',\n 'chmod',\n 'chown',\n 'exists',\n 'mkdir',\n 'lchown',\n 'lstat',\n 'lutimes',\n 'open',\n 'opendir',\n 'readdir',\n 'readFile',\n 'readlink',\n 'realpath',\n 'realpath.native',\n 'rm',\n 'rmdir',\n 'stat',\n 'truncate',\n 'unlink',\n 'utimes',\n 'writeFile',\n 'accessSync',\n 'appendFileSync',\n 'chmodSync',\n 'chownSync',\n 'existsSync',\n 'lchownSync',\n 'lstatSync',\n 'lutimesSync',\n 'opendirSync',\n 'mkdirSync',\n 'openSync',\n 'readdirSync',\n 'readFileSync',\n 'readlinkSync',\n 'realpathSync',\n 'realpathSync.native',\n 'rmdirSync',\n 'rmSync',\n 'statSync',\n 'truncateSync',\n 'unlinkSync',\n 'utimesSync',\n 'writeFileSync',\n];\n\n/**\n * Builds the span attributes for a given `fs` operation, optionally including the file path arguments.\n */\nfunction getSpanAttributes(\n functionName: FMember | FPMember,\n args: ArrayLike<unknown>,\n config: FsInstrumentationConfig,\n): SpanAttributes {\n const attributes: SpanAttributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: SPAN_OP,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: SPAN_ORIGIN,\n };\n\n if (!config.recordFilePaths) {\n return attributes;\n }\n\n if (typeof args[0] === 'string' && FS_OPERATIONS_WITH_PATH_ARG.includes(functionName)) {\n attributes['path_argument'] = args[0];\n } else if (typeof args[0] === 'string' && typeof args[1] === 'string') {\n if (FS_OPERATIONS_WITH_TARGET_PATH.includes(functionName)) {\n attributes['target_argument'] = args[0];\n attributes['path_argument'] = args[1];\n } else if (FS_OPERATIONS_WITH_EXISTING_PATH_NEW_PATH.includes(functionName)) {\n attributes['existing_path_argument'] = args[0];\n attributes['new_path_argument'] = args[1];\n } else if (FS_OPERATIONS_WITH_SRC_DEST.includes(functionName)) {\n attributes['src_argument'] = args[0];\n attributes['dest_argument'] = args[1];\n } else if (FS_OPERATIONS_WITH_OLD_PATH_NEW_PATH.includes(functionName)) {\n attributes['old_path_argument'] = args[0];\n attributes['new_path_argument'] = args[1];\n }\n } else if (typeof args[0] === 'string' && FS_OPERATIONS_WITH_PREFIX.includes(functionName)) {\n attributes['prefix_argument'] = args[0];\n }\n\n return attributes;\n}\n\n/**\n * This is important for 2-level functions like `realpath.native` to retain the 2nd-level\n * when patching the 1st-level.\n */\nfunction patchedFunctionWithOriginalProperties<T extends GenericFunction>(patchedFunction: T, original: T): T {\n return Object.assign(patchedFunction, original);\n}\n\nexport class FsInstrumentation extends InstrumentationBase<FsInstrumentationConfig> {\n public constructor(config: FsInstrumentationConfig = {}) {\n super(PACKAGE_NAME, SDK_VERSION, config);\n }\n\n public init(): InstrumentationNodeModuleDefinition[] {\n return [\n new InstrumentationNodeModuleDefinition(\n 'fs',\n ['*'],\n (fs: FS) => {\n for (const fName of SYNC_FUNCTIONS) {\n const { objectToPatch, functionNameToPatch } = indexFs(fs, fName);\n\n if (isWrapped(objectToPatch[functionNameToPatch])) {\n this._unwrap(objectToPatch, functionNameToPatch);\n }\n this._wrap(objectToPatch, functionNameToPatch, this._patchSyncFunction.bind(this, fName));\n }\n for (const fName of CALLBACK_FUNCTIONS) {\n const { objectToPatch, functionNameToPatch } = indexFs(fs, fName);\n if (isWrapped(objectToPatch[functionNameToPatch])) {\n this._unwrap(objectToPatch, functionNameToPatch);\n }\n if (fName === 'exists') {\n // handling separately because of the inconsistent cb style:\n // `exists` doesn't have error as the first argument, but the result\n this._wrap(objectToPatch, functionNameToPatch, this._patchExistsCallbackFunction.bind(this, fName));\n continue;\n }\n this._wrap(objectToPatch, functionNameToPatch, this._patchCallbackFunction.bind(this, fName));\n }\n for (const fName of PROMISE_FUNCTIONS) {\n if (isWrapped(fs.promises[fName])) {\n this._unwrap(fs.promises, fName);\n }\n this._wrap(fs.promises, fName, this._patchPromiseFunction.bind(this, fName));\n }\n return fs;\n },\n (fs: FS) => {\n if (fs === undefined) return;\n for (const fName of SYNC_FUNCTIONS) {\n const { objectToPatch, functionNameToPatch } = indexFs(fs, fName);\n if (isWrapped(objectToPatch[functionNameToPatch])) {\n this._unwrap(objectToPatch, functionNameToPatch);\n }\n }\n for (const fName of CALLBACK_FUNCTIONS) {\n const { objectToPatch, functionNameToPatch } = indexFs(fs, fName);\n if (isWrapped(objectToPatch[functionNameToPatch])) {\n this._unwrap(objectToPatch, functionNameToPatch);\n }\n }\n for (const fName of PROMISE_FUNCTIONS) {\n if (isWrapped(fs.promises[fName])) {\n this._unwrap(fs.promises, fName);\n }\n }\n },\n ),\n new InstrumentationNodeModuleDefinition(\n 'fs/promises',\n ['*'],\n (fsPromises: FSPromises) => {\n for (const fName of PROMISE_FUNCTIONS) {\n if (isWrapped(fsPromises[fName])) {\n this._unwrap(fsPromises, fName);\n }\n this._wrap(fsPromises, fName, this._patchPromiseFunction.bind(this, fName));\n }\n return fsPromises;\n },\n (fsPromises: FSPromises) => {\n if (fsPromises === undefined) return;\n for (const fName of PROMISE_FUNCTIONS) {\n if (isWrapped(fsPromises[fName])) {\n this._unwrap(fsPromises, fName);\n }\n }\n },\n ),\n ];\n }\n\n protected _patchSyncFunction<T extends GenericFunction>(functionName: FMember, original: T): T {\n // oxlint-disable-next-line typescript/no-this-alias\n const instrumentation = this;\n const patchedFunction = function (this: unknown, ...args: Parameters<T>): ReturnType<T> {\n const config = instrumentation.getConfig();\n const attributes = getSpanAttributes(functionName, args, config);\n\n return startSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes }, span => {\n try {\n // Suppress tracing for internal fs calls\n return suppressTracing(() => original.apply(this, args)) as ReturnType<T>;\n } catch (error) {\n recordError(span, error, config);\n throw error;\n }\n });\n };\n return patchedFunctionWithOriginalProperties(patchedFunction as T, original);\n }\n\n protected _patchCallbackFunction<T extends GenericFunction>(functionName: FMember, original: T): T {\n // oxlint-disable-next-line typescript/no-this-alias\n const instrumentation = this;\n const patchedFunction = function (this: unknown, ...args: Parameters<T>): ReturnType<T> {\n const config = instrumentation.getConfig();\n\n const lastIdx = args.length - 1;\n const cb: unknown = args[lastIdx];\n if (typeof cb !== 'function') {\n // TODO: what to do if we are pretty sure it's going to throw\n return original.apply(this, args) as ReturnType<T>;\n }\n\n const attributes = getSpanAttributes(functionName, args, config);\n const span = startInactiveSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes });\n\n // Return to the context active during the call in the callback\n args[lastIdx] = context.bind(context.active(), function (this: unknown, ...cbArgs: unknown[]) {\n const error = cbArgs[0];\n if (error) {\n recordError(span, error, config);\n }\n span.end();\n return cb.apply(this, cbArgs);\n });\n\n try {\n // Suppress tracing for internal fs calls\n return suppressTracing(() => original.apply(this, args)) as ReturnType<T>;\n } catch (error) {\n recordError(span, error, config);\n span.end();\n throw error;\n }\n };\n return patchedFunctionWithOriginalProperties(patchedFunction as T, original);\n }\n\n protected _patchExistsCallbackFunction<T extends GenericFunction>(functionName: 'exists', original: T): T {\n // oxlint-disable-next-line typescript/no-this-alias\n const instrumentation = this;\n const patchedFunction = function (this: unknown, ...args: Parameters<T>): ReturnType<T> {\n const config = instrumentation.getConfig();\n\n const lastIdx = args.length - 1;\n const cb: unknown = args[lastIdx];\n if (typeof cb !== 'function') {\n return original.apply(this, args) as ReturnType<T>;\n }\n\n const attributes = getSpanAttributes(functionName, args, config);\n const span = startInactiveSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes });\n\n // Return to the context active during the call in the callback\n args[lastIdx] = context.bind(context.active(), function (this: unknown, ...cbArgs: unknown[]) {\n // `exists` never calls the callback with an error\n span.end();\n return cb.apply(this, cbArgs);\n });\n\n try {\n // Suppress tracing for internal fs calls\n return suppressTracing(() => original.apply(this, args)) as ReturnType<T>;\n } catch (error) {\n recordError(span, error, config);\n span.end();\n throw error;\n }\n };\n const functionWithOriginalProperties = patchedFunctionWithOriginalProperties(patchedFunction as T, original);\n\n // `exists` has a custom promisify function because of the inconsistent signature\n // replicating that on the patched function\n const promisified = function (path: unknown): Promise<unknown> {\n return new Promise(resolve => (functionWithOriginalProperties as GenericFunction)(path, resolve));\n };\n Object.defineProperty(promisified, 'name', { value: functionName });\n Object.defineProperty(functionWithOriginalProperties, promisify.custom, {\n value: promisified,\n });\n\n return functionWithOriginalProperties;\n }\n\n protected _patchPromiseFunction<T extends GenericFunction>(functionName: FPMember, original: T): T {\n // oxlint-disable-next-line typescript/no-this-alias\n const instrumentation = this;\n const patchedFunction = async function (this: unknown, ...args: Parameters<T>): Promise<unknown> {\n const config = instrumentation.getConfig();\n const attributes = getSpanAttributes(functionName, args, config);\n\n return startSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes }, async span => {\n try {\n // Suppress tracing for internal fs calls\n return await suppressTracing(() => original.apply(this, args) as Promise<unknown>);\n } catch (error) {\n recordError(span, error, config);\n throw error;\n }\n });\n };\n return patchedFunctionWithOriginalProperties(patchedFunction as unknown as T, original);\n }\n}\n\n/**\n * Sets the error status on the span and, if configured, records the error message as a span attribute.\n */\nfunction recordError(span: Span, error: unknown, config: FsInstrumentationConfig): void {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });\n if (config.recordErrorMessagesAsSpanAttributes && error instanceof Error) {\n span.setAttribute('fs_error', error.message);\n }\n}\n"],"names":["SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","InstrumentationBase","SDK_VERSION","InstrumentationNodeModuleDefinition","SYNC_FUNCTIONS","indexFs","isWrapped","CALLBACK_FUNCTIONS","PROMISE_FUNCTIONS","startSpan","suppressTracing","startInactiveSpan","context","promisify","SPAN_STATUS_ERROR"],"mappings":";;;;;;;;;AAkCA,MAAM,YAAA,GAAe,4BAAA;AAErB,MAAM,WAAA,GAAc,cAAA;AACpB,MAAM,OAAA,GAAU,MAAA;AAIhB,MAAM,oCAAA,GAAuC,CAAC,QAAA,EAAU,YAAY,CAAA;AACpE,MAAM,2BAAA,GAA8B,CAAC,UAAA,EAAY,IAAA,EAAM,gBAAgB,QAAQ,CAAA;AAC/E,MAAM,yCAAA,GAA4C,CAAC,MAAA,EAAQ,UAAU,CAAA;AACrE,MAAM,yBAAA,GAA4B,CAAC,SAAA,EAAW,aAAa,CAAA;AAC3D,MAAM,8BAAA,GAAiC,CAAC,SAAA,EAAW,aAAa,CAAA;AAChE,M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D,MAAA,OAAOJ,cAAA,CAAU,EAAE,IAAA,EAAM,CAAA,GAAA,EAAM,YAAY,CAAA,CAAA,EAAI,YAAA,EAAc,IAAA,EAAM,UAAA,EAAW,EAAG,OAAM,IAAA,KAAQ;AAC7F,QAAA,IAAI;AAEF,UAAA,OAAO,MAAMC,oBAAA,CAAgB,MAAM,SAAS,KAAA,CAAM,IAAA,EAAM,IAAI,CAAqB,CAAA;AAAA,QACnF,SAAS,KAAA,EAAO;AACd,UAAA,WAAA,CAAY,IAAA,EAAM,OAAO,MAAM,CAAA;AAC/B,UAAA,MAAM,KAAA;AAAA,QACR;AAAA,MACF,CAAC,CAAA;AAAA,IACH,CAAA;AACA,IAAA,OAAO,qCAAA,CAAsC,iBAAiC,QAAQ,CAAA;AAAA,EACxF;AACF;AAKA,SAAS,WAAA,CAAY,IAAA,EAAY,KAAA,EAAgB,MAAA,EAAuC;AACtF,EAAA,IAAA,CAAK,UAAU,EAAE,IAAA,EAAMI,sBAAA,EAAmB,OAAA,EAAS,kBAAkB,CAAA;AACrE,EAAA,IAAI,MAAA,CAAO,mCAAA,IAAuC,KAAA,YAAiB,KAAA,EAAO;AACxE,IAAA,IAAA,CAAK,YAAA,CAAa,UAAA,EAAY,KAAA,CAAM,OAAO,CAAA;AAAA,EAC7C;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sources":["../../../../../src/integrations/fs/vendored/instrumentation.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/15ef7506553f631ea4181391e0c5725a56f0d082/packages/instrumentation-fs\n * - Upstream version: @opentelemetry/instrumentation-fs@0.37.0\n * - Minor TypeScript strictness adjustments for this repository's compiler settings\n * - The OpenTelemetry tracer APIs were replaced with Sentry's `startSpan`/`startInactiveSpan`/`suppressTracing`\n * and the configurable `createHook`/`endHook`/`requireParentSpan` options were removed in favor of inlined,\n * Sentry-specific span attributes.\n * - Completely reworked to no longer reference OpenTelemetry.\n */\n\nimport type { Span, SpanAttributes } from '@sentry/core';\nimport {\n SEMANTIC_ATTRIBUTE_SENTRY_OP,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SPAN_STATUS_ERROR,\n getActiveSpan,\n startInactiveSpan,\n startSpan,\n suppressTracing,\n withActiveSpan,\n} from '@sentry/core';\nimport * as fs from 'fs';\nimport { promisify } from 'util';\nimport { CALLBACK_FUNCTIONS, PROMISE_FUNCTIONS, SYNC_FUNCTIONS } from './constants';\nimport type { FMember, FPMember, FsInstrumentationConfig, GenericFunction } from './types';\nimport { indexFs } from './utils';\n\nconst SPAN_ORIGIN = 'auto.file.fs';\nconst SPAN_OP = 'file';\n\n// The following lists categorize `fs` functions by the shape of their leading path arguments, so we can\n// record meaningful span attributes for them. These are Sentry-specific additions (not part of upstream).\nconst FS_OPERATIONS_WITH_OLD_PATH_NEW_PATH = ['rename', 'renameSync'];\nconst FS_OPERATIONS_WITH_SRC_DEST = ['copyFile', 'cp', 'copyFileSync', 'cpSync'];\nconst FS_OPERATIONS_WITH_EXISTING_PATH_NEW_PATH = ['link', 'linkSync'];\nconst FS_OPERATIONS_WITH_PREFIX = ['mkdtemp', 'mkdtempSync'];\nconst FS_OPERATIONS_WITH_TARGET_PATH = ['symlink', 'symlinkSync'];\nconst FS_OPERATIONS_WITH_PATH_ARG = [\n 'access',\n 'appendFile',\n 'chmod',\n 'chown',\n 'exists',\n 'mkdir',\n 'lchown',\n 'lstat',\n 'lutimes',\n 'open',\n 'opendir',\n 'readdir',\n 'readFile',\n 'readlink',\n 'realpath',\n 'realpath.native',\n 'rm',\n 'rmdir',\n 'stat',\n 'truncate',\n 'unlink',\n 'utimes',\n 'writeFile',\n 'accessSync',\n 'appendFileSync',\n 'chmodSync',\n 'chownSync',\n 'existsSync',\n 'lchownSync',\n 'lstatSync',\n 'lutimesSync',\n 'opendirSync',\n 'mkdirSync',\n 'openSync',\n 'readdirSync',\n 'readFileSync',\n 'readlinkSync',\n 'realpathSync',\n 'realpathSync.native',\n 'rmdirSync',\n 'rmSync',\n 'statSync',\n 'truncateSync',\n 'unlinkSync',\n 'utimesSync',\n 'writeFileSync',\n];\n\n/**\n * Builds the span attributes for a given `fs` operation, optionally including the file path arguments.\n */\nfunction getSpanAttributes(\n functionName: FMember | FPMember,\n args: ArrayLike<unknown>,\n config: FsInstrumentationConfig,\n): SpanAttributes {\n const attributes: SpanAttributes = {\n [SEMANTIC_ATTRIBUTE_SENTRY_OP]: SPAN_OP,\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: SPAN_ORIGIN,\n };\n\n if (!config.recordFilePaths) {\n return attributes;\n }\n\n if (typeof args[0] === 'string' && FS_OPERATIONS_WITH_PATH_ARG.includes(functionName)) {\n attributes['path_argument'] = args[0];\n } else if (typeof args[0] === 'string' && typeof args[1] === 'string') {\n if (FS_OPERATIONS_WITH_TARGET_PATH.includes(functionName)) {\n attributes['target_argument'] = args[0];\n attributes['path_argument'] = args[1];\n } else if (FS_OPERATIONS_WITH_EXISTING_PATH_NEW_PATH.includes(functionName)) {\n attributes['existing_path_argument'] = args[0];\n attributes['new_path_argument'] = args[1];\n } else if (FS_OPERATIONS_WITH_SRC_DEST.includes(functionName)) {\n attributes['src_argument'] = args[0];\n attributes['dest_argument'] = args[1];\n } else if (FS_OPERATIONS_WITH_OLD_PATH_NEW_PATH.includes(functionName)) {\n attributes['old_path_argument'] = args[0];\n attributes['new_path_argument'] = args[1];\n }\n } else if (typeof args[0] === 'string' && FS_OPERATIONS_WITH_PREFIX.includes(functionName)) {\n attributes['prefix_argument'] = args[0];\n }\n\n return attributes;\n}\n\n/**\n * This is important for 2-level functions like `realpath.native` to retain the 2nd-level\n * when patching the 1st-level.\n */\nfunction patchedFunctionWithOriginalProperties<T extends GenericFunction>(patchedFunction: T, original: T): T {\n return Object.assign(patchedFunction, original);\n}\n\n// Tracks patched methods to prevent double-patching if `enableFsInstrumentation` is called more than once.\nconst _patched = new WeakMap<Record<string, GenericFunction>, Set<string>>();\n\nfunction _patchMethod(\n obj: Record<string, GenericFunction>,\n name: string,\n wrapper: (original: GenericFunction) => GenericFunction,\n): void {\n const original = obj[name];\n if (typeof original !== 'function') return;\n let patched = _patched.get(obj);\n if (!patched) {\n patched = new Set();\n _patched.set(obj, patched);\n }\n if (patched.has(name)) return;\n patched.add(name);\n obj[name] = wrapper(original);\n}\n\nfunction _patchSyncFunction<T extends GenericFunction>(\n functionName: FMember,\n original: T,\n config: FsInstrumentationConfig,\n): T {\n const patchedFunction = function (this: unknown, ...args: Parameters<T>): ReturnType<T> {\n const attributes = getSpanAttributes(functionName, args, config);\n return startSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes }, span => {\n try {\n return suppressTracing(() => original.apply(this, args)) as ReturnType<T>;\n } catch (error) {\n recordError(span, error, config);\n throw error;\n }\n });\n };\n return patchedFunctionWithOriginalProperties(patchedFunction as T, original);\n}\n\nfunction _patchCallbackFunction<T extends GenericFunction>(\n functionName: FMember,\n original: T,\n config: FsInstrumentationConfig,\n): T {\n const patchedFunction = function (this: unknown, ...args: Parameters<T>): ReturnType<T> {\n const lastIdx = args.length - 1;\n const cb: unknown = args[lastIdx];\n if (typeof cb !== 'function') {\n return original.apply(this, args) as ReturnType<T>;\n }\n\n const attributes = getSpanAttributes(functionName, args, config);\n const span = startInactiveSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes });\n const parentSpan = getActiveSpan();\n\n // Wrap the callback to end the span and restore the caller's active span context.\n // fs callbacks fire from Node's I/O event loop where the AsyncLocalStorage context\n // is lost, so any spans created inside the callback would otherwise have no parent.\n args[lastIdx] = function (this: unknown, ...cbArgs: unknown[]) {\n const error = cbArgs[0];\n if (error) {\n recordError(span, error, config);\n }\n span.end();\n if (parentSpan) {\n return withActiveSpan(parentSpan, () => (cb as GenericFunction).apply(this, cbArgs));\n }\n return (cb as GenericFunction).apply(this, cbArgs);\n };\n\n try {\n return suppressTracing(() => original.apply(this, args)) as ReturnType<T>;\n } catch (error) {\n recordError(span, error, config);\n span.end();\n throw error;\n }\n };\n return patchedFunctionWithOriginalProperties(patchedFunction as T, original);\n}\n\nfunction _patchExistsCallbackFunction<T extends GenericFunction>(original: T, config: FsInstrumentationConfig): T {\n const functionName = 'exists' as FMember;\n const patchedFunction = function (this: unknown, ...args: Parameters<T>): ReturnType<T> {\n const lastIdx = args.length - 1;\n const cb: unknown = args[lastIdx];\n if (typeof cb !== 'function') {\n return original.apply(this, args) as ReturnType<T>;\n }\n\n const attributes = getSpanAttributes(functionName, args, config);\n const span = startInactiveSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes });\n const parentSpan = getActiveSpan();\n\n // `exists` never calls the callback with an error\n args[lastIdx] = function (this: unknown, ...cbArgs: unknown[]) {\n span.end();\n if (parentSpan) {\n return withActiveSpan(parentSpan, () => (cb as GenericFunction).apply(this, cbArgs));\n }\n return (cb as GenericFunction).apply(this, cbArgs);\n };\n\n try {\n return suppressTracing(() => original.apply(this, args)) as ReturnType<T>;\n } catch (error) {\n recordError(span, error, config);\n span.end();\n throw error;\n }\n };\n const functionWithOriginalProperties = patchedFunctionWithOriginalProperties(patchedFunction as T, original);\n\n // `exists` has a custom promisify function because of the inconsistent signature\n // replicating that on the patched function\n const promisified = function (path: unknown): Promise<unknown> {\n return new Promise(resolve => (functionWithOriginalProperties as GenericFunction)(path, resolve));\n };\n Object.defineProperty(promisified, 'name', { value: functionName });\n Object.defineProperty(functionWithOriginalProperties, promisify.custom, {\n value: promisified,\n });\n\n return functionWithOriginalProperties;\n}\n\nfunction _patchPromiseFunction<T extends GenericFunction>(\n functionName: FPMember,\n original: T,\n config: FsInstrumentationConfig,\n): T {\n const patchedFunction = async function (this: unknown, ...args: Parameters<T>): Promise<unknown> {\n const attributes = getSpanAttributes(functionName, args, config);\n return startSpan({ name: `fs.${functionName}`, onlyIfParent: true, attributes }, async span => {\n try {\n return await suppressTracing(() => original.apply(this, args) as Promise<unknown>);\n } catch (error) {\n recordError(span, error, config);\n throw error;\n }\n });\n };\n return patchedFunctionWithOriginalProperties(patchedFunction as unknown as T, original);\n}\n\nexport function enableFsInstrumentation(config: FsInstrumentationConfig = {}): void {\n for (const fName of SYNC_FUNCTIONS) {\n const { objectToPatch, functionNameToPatch } = indexFs(fs, fName);\n _patchMethod(objectToPatch, functionNameToPatch, original => _patchSyncFunction(fName, original, config));\n }\n\n for (const fName of CALLBACK_FUNCTIONS) {\n const { objectToPatch, functionNameToPatch } = indexFs(fs, fName);\n if (fName === 'exists') {\n _patchMethod(objectToPatch, functionNameToPatch, original => _patchExistsCallbackFunction(original, config));\n } else {\n _patchMethod(objectToPatch, functionNameToPatch, original => _patchCallbackFunction(fName, original, config));\n }\n }\n\n // `fs.promises` and `import { readFile } from 'fs/promises'` share the same object in Node 14+,\n // so patching one covers both.\n const fsPromises = fs.promises as unknown as Record<string, GenericFunction>;\n for (const fName of PROMISE_FUNCTIONS) {\n _patchMethod(fsPromises, fName, original => _patchPromiseFunction(fName, original, config));\n }\n}\n\n/**\n * Sets the error status on the span and, if configured, records the error message as a span attribute.\n */\nfunction recordError(span: Span, error: unknown, config: FsInstrumentationConfig): void {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });\n if (config.recordErrorMessagesAsSpanAttributes && error instanceof Error) {\n span.setAttribute('fs_error', error.message);\n }\n}\n"],"names":["SEMANTIC_ATTRIBUTE_SENTRY_OP","SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN","startSpan","suppressTracing","startInactiveSpan","getActiveSpan","withActiveSpan","promisify","SYNC_FUNCTIONS","indexFs","CALLBACK_FUNCTIONS","PROMISE_FUNCTIONS","SPAN_STATUS_ERROR"],"mappings":";;;;;;;;AA+BA,MAAM,WAAA,GAAc,cAAA;AACpB,MAAM,OAAA,GAAU,MAAA;AAIhB,MAAM,oCAAA,GAAuC,CAAC,QAAA,EAAU,YAAY,CAAA;AACpE,MA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AAmB;AACrC,IAAA,YAAA,CAAa,YAAY,KAAA,EAAO,CAAA,QAAA,KAAY,sBAAsB,KAAA,EAAO,QAAA,EAAU,MAAM,CAAC,CAAA;AAAA,EAC5F;AACF;AAKA,SAAS,WAAA,CAAY,IAAA,EAAY,KAAA,EAAgB,MAAA,EAAuC;AACtF,EAAA,IAAA,CAAK,UAAU,EAAE,IAAA,EAAMC,sBAAA,EAAmB,OAAA,EAAS,kBAAkB,CAAA;AACrE,EAAA,IAAI,MAAA,CAAO,mCAAA,IAAuC,KAAA,YAAiB,KAAA,EAAO;AACxE,IAAA,IAAA,CAAK,YAAA,CAAa,UAAA,EAAY,KAAA,CAAM,OAAO,CAAA;AAAA,EAC7C;AACF;;;;"}
|
|
@@ -5,13 +5,13 @@ const core = require('@sentry/core');
|
|
|
5
5
|
const nodeCore = require('@sentry/node-core');
|
|
6
6
|
|
|
7
7
|
const INTEGRATION_NAME = "NodeFetch";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return _getConfigWithDefaults(options);
|
|
8
|
+
let _undiciInstrumentation;
|
|
9
|
+
function instrumentNodeFetchSpans(options) {
|
|
10
|
+
if (!_undiciInstrumentation) {
|
|
11
|
+
_undiciInstrumentation = new undici.UndiciInstrumentation(_getConfigWithDefaults(options));
|
|
13
12
|
}
|
|
14
|
-
);
|
|
13
|
+
_undiciInstrumentation.enable();
|
|
14
|
+
}
|
|
15
15
|
const instrumentSentryNodeFetch = nodeCore.generateInstrumentOnce(
|
|
16
16
|
`${INTEGRATION_NAME}.sentry`,
|
|
17
17
|
nodeCore.SentryNodeFetchInstrumentation,
|
|
@@ -25,7 +25,7 @@ const _nativeNodeFetchIntegration = ((options = {}) => {
|
|
|
25
25
|
setupOnce() {
|
|
26
26
|
const instrumentSpans = _shouldInstrumentSpans(options, core.getClient()?.getOptions());
|
|
27
27
|
if (instrumentSpans) {
|
|
28
|
-
|
|
28
|
+
instrumentNodeFetchSpans(options);
|
|
29
29
|
}
|
|
30
30
|
instrumentSentryNodeFetch(options);
|
|
31
31
|
}
|
|
@@ -47,7 +47,6 @@ function _shouldInstrumentSpans(options, clientOptions = {}) {
|
|
|
47
47
|
}
|
|
48
48
|
function _getConfigWithDefaults(options = {}) {
|
|
49
49
|
const instrumentationConfig = {
|
|
50
|
-
requireParentforSpans: false,
|
|
51
50
|
ignoreRequestHook: (request) => {
|
|
52
51
|
const url = getAbsoluteUrl(request.origin, request.path);
|
|
53
52
|
const _ignoreOutgoingRequests = options.ignoreOutgoingRequests;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/integrations/node-fetch/index.ts"],"sourcesContent":["import type { UndiciInstrumentationConfig } from './vendored/types';\nimport { UndiciInstrumentation } from './vendored/undici';\nimport type { IntegrationFn } from '@sentry/core';\nimport {\n defineIntegration,\n getClient,\n hasSpansEnabled,\n SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_URL_FULL,\n stripDataUrlContent,\n} from '@sentry/core';\nimport type { NodeClient } from '@sentry/node-core';\nimport { generateInstrumentOnce, SentryNodeFetchInstrumentation } from '@sentry/node-core';\nimport type { NodeClientOptions } from '../../types';\n\nconst INTEGRATION_NAME = 'NodeFetch';\n\ninterface NodeFetchOptions extends Pick<\n UndiciInstrumentationConfig,\n 'requestHook' | 'responseHook' | 'headersToSpanAttributes'\n> {\n /**\n * Whether breadcrumbs should be recorded for requests.\n * Defaults to true\n */\n breadcrumbs?: boolean;\n\n /**\n * If set to false, do not emit any spans.\n * This will ensure that the default UndiciInstrumentation from OpenTelemetry is not setup,\n * only the Sentry-specific instrumentation for breadcrumbs & trace propagation is applied.\n *\n * If `skipOpenTelemetrySetup: true` is configured, this defaults to `false`, otherwise it defaults to `true`.\n */\n spans?: boolean;\n\n /**\n * Whether to inject trace propagation headers (sentry-trace, baggage, traceparent) into outgoing fetch requests.\n *\n * When set to `false`, Sentry will not inject any trace propagation headers, but will still create breadcrumbs\n * (if `breadcrumbs` is enabled). This is useful when `skipOpenTelemetrySetup: true` is configured and you want\n * to avoid duplicate trace headers being injected by both Sentry and OpenTelemetry's UndiciInstrumentation.\n *\n * @default `true`\n */\n tracePropagation?: boolean;\n\n /**\n * Do not capture spans or breadcrumbs for outgoing fetch requests to URLs where the given callback returns `true`.\n * This controls both span & breadcrumb creation - spans will be non recording if tracing is disabled.\n */\n ignoreOutgoingRequests?: (url: string) => boolean;\n}\n\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/integrations/node-fetch/index.ts"],"sourcesContent":["import type { UndiciInstrumentationConfig } from './vendored/types';\nimport { UndiciInstrumentation } from './vendored/undici';\nimport type { IntegrationFn } from '@sentry/core';\nimport {\n defineIntegration,\n getClient,\n hasSpansEnabled,\n SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME,\n SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,\n SEMANTIC_ATTRIBUTE_URL_FULL,\n stripDataUrlContent,\n} from '@sentry/core';\nimport type { NodeClient } from '@sentry/node-core';\nimport { generateInstrumentOnce, SentryNodeFetchInstrumentation } from '@sentry/node-core';\nimport type { NodeClientOptions } from '../../types';\n\nconst INTEGRATION_NAME = 'NodeFetch';\n\ninterface NodeFetchOptions extends Pick<\n UndiciInstrumentationConfig,\n 'requestHook' | 'responseHook' | 'headersToSpanAttributes'\n> {\n /**\n * Whether breadcrumbs should be recorded for requests.\n * Defaults to true\n */\n breadcrumbs?: boolean;\n\n /**\n * If set to false, do not emit any spans.\n * This will ensure that the default UndiciInstrumentation from OpenTelemetry is not setup,\n * only the Sentry-specific instrumentation for breadcrumbs & trace propagation is applied.\n *\n * If `skipOpenTelemetrySetup: true` is configured, this defaults to `false`, otherwise it defaults to `true`.\n */\n spans?: boolean;\n\n /**\n * Whether to inject trace propagation headers (sentry-trace, baggage, traceparent) into outgoing fetch requests.\n *\n * When set to `false`, Sentry will not inject any trace propagation headers, but will still create breadcrumbs\n * (if `breadcrumbs` is enabled). This is useful when `skipOpenTelemetrySetup: true` is configured and you want\n * to avoid duplicate trace headers being injected by both Sentry and OpenTelemetry's UndiciInstrumentation.\n *\n * @default `true`\n */\n tracePropagation?: boolean;\n\n /**\n * Do not capture spans or breadcrumbs for outgoing fetch requests to URLs where the given callback returns `true`.\n * This controls both span & breadcrumb creation - spans will be non recording if tracing is disabled.\n */\n ignoreOutgoingRequests?: (url: string) => boolean;\n}\n\nlet _undiciInstrumentation: UndiciInstrumentation | undefined;\n\n// Sets up the vendored undici instrumentation (emits `http.client` spans & propagates traces).\n// The module-level singleton mirrors `generateInstrumentOnce`'s \"instrument once per process\" behavior.\nfunction instrumentNodeFetchSpans(options: NodeFetchOptions): void {\n if (!_undiciInstrumentation) {\n _undiciInstrumentation = new UndiciInstrumentation(_getConfigWithDefaults(options));\n }\n _undiciInstrumentation.enable();\n}\n\nconst instrumentSentryNodeFetch = generateInstrumentOnce(\n `${INTEGRATION_NAME}.sentry`,\n SentryNodeFetchInstrumentation,\n (options: NodeFetchOptions) => {\n return options;\n },\n);\n\nconst _nativeNodeFetchIntegration = ((options: NodeFetchOptions = {}) => {\n return {\n name: 'NodeFetch',\n setupOnce() {\n const instrumentSpans = _shouldInstrumentSpans(options, getClient<NodeClient>()?.getOptions());\n\n // This is the instrumentation that emits spans & propagates traces for outgoing fetch requests\n if (instrumentSpans) {\n instrumentNodeFetchSpans(options);\n }\n\n // This is the Sentry-specific instrumentation that creates breadcrumbs & propagates traces.\n // It must subscribe to the diagnostics channels after the span instrumentation above, so the core\n // trace propagation logic takes precedence. Otherwise, the sentry-trace header may be set multiple times.\n instrumentSentryNodeFetch(options);\n },\n };\n}) satisfies IntegrationFn;\n\nexport const nativeNodeFetchIntegration = defineIntegration(_nativeNodeFetchIntegration);\n\n// Matching the behavior of the base instrumentation\nfunction getAbsoluteUrl(origin: string, path: string = '/'): string {\n const url = `${origin}`;\n\n if (url.endsWith('/') && path.startsWith('/')) {\n return `${url}${path.slice(1)}`;\n }\n\n if (!url.endsWith('/') && !path.startsWith('/')) {\n return `${url}/${path}`;\n }\n\n return `${url}${path}`;\n}\n\nfunction _shouldInstrumentSpans(options: NodeFetchOptions, clientOptions: Partial<NodeClientOptions> = {}): boolean {\n // If `spans` is passed in, it takes precedence\n // Else, we by default emit spans, unless `skipOpenTelemetrySetup` is set to `true` or spans are not enabled\n return typeof options.spans === 'boolean'\n ? options.spans\n : !clientOptions.skipOpenTelemetrySetup && hasSpansEnabled(clientOptions);\n}\n\n/** Exported only for tests. */\nexport function _getConfigWithDefaults(options: Partial<NodeFetchOptions> = {}): UndiciInstrumentationConfig {\n const instrumentationConfig = {\n ignoreRequestHook: request => {\n const url = getAbsoluteUrl(request.origin, request.path);\n const _ignoreOutgoingRequests = options.ignoreOutgoingRequests;\n const shouldIgnore = _ignoreOutgoingRequests && url && _ignoreOutgoingRequests(url);\n\n return !!shouldIgnore;\n },\n startSpanHook: request => {\n const url = getAbsoluteUrl(request.origin, request.path);\n\n // Sanitize data URLs to prevent long base64 strings in span attributes\n if (url.startsWith('data:')) {\n const sanitizedUrl = stripDataUrlContent(url);\n return {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.node_fetch',\n 'http.url': sanitizedUrl,\n [SEMANTIC_ATTRIBUTE_URL_FULL]: sanitizedUrl,\n [SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME]: `${request.method || 'GET'} ${sanitizedUrl}`,\n };\n }\n\n return {\n [SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.otel.node_fetch',\n };\n },\n requestHook: options.requestHook,\n responseHook: options.responseHook,\n headersToSpanAttributes: options.headersToSpanAttributes,\n } satisfies UndiciInstrumentationConfig;\n\n return instrumentationConfig;\n}\n"],"names":["UndiciInstrumentation","generateInstrumentOnce","SentryNodeFetchInstrumentation","getClient","defineIntegration","has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ACC,qCAAgC,GAAG,2BAAA;AAAA,UACpC,UAAA,EAAY,YAAA;AAAA,UACZ,CAACC,gCAA2B,GAAG,YAAA;AAAA,UAC/B,CAACC,+CAA0C,GAAG,CAAA,EAAG,QAAQ,MAAA,IAAU,KAAK,IAAI,YAAY,CAAA;AAAA,SAC1F;AAAA,MACF;AAEA,MAAA,OAAO;AAAA,QACL,CAACF,qCAAgC,GAAG;AAAA,OACtC;AAAA,IACF,CAAA;AAAA,IACA,aAAa,OAAA,CAAQ,WAAA;AAAA,IACrB,cAAc,OAAA,CAAQ,YAAA;AAAA,IACtB,yBAAyB,OAAA,CAAQ;AAAA,GACnC;AAEA,EAAA,OAAO,qBAAA;AACT;;;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const ATTR_HTTP_REQUEST_METHOD = "http.request.method";
|
|
4
|
+
const ATTR_HTTP_REQUEST_METHOD_ORIGINAL = "http.request.method_original";
|
|
5
|
+
const ATTR_HTTP_RESPONSE_STATUS_CODE = "http.response.status_code";
|
|
6
|
+
const ATTR_NETWORK_PEER_ADDRESS = "network.peer.address";
|
|
7
|
+
const ATTR_NETWORK_PEER_PORT = "network.peer.port";
|
|
8
|
+
const ATTR_SERVER_ADDRESS = "server.address";
|
|
9
|
+
const ATTR_SERVER_PORT = "server.port";
|
|
10
|
+
const ATTR_URL_FULL = "url.full";
|
|
11
|
+
const ATTR_URL_PATH = "url.path";
|
|
12
|
+
const ATTR_URL_QUERY = "url.query";
|
|
13
|
+
const ATTR_URL_SCHEME = "url.scheme";
|
|
14
|
+
const ATTR_USER_AGENT_ORIGINAL = "user_agent.original";
|
|
15
|
+
|
|
16
|
+
exports.ATTR_HTTP_REQUEST_METHOD = ATTR_HTTP_REQUEST_METHOD;
|
|
17
|
+
exports.ATTR_HTTP_REQUEST_METHOD_ORIGINAL = ATTR_HTTP_REQUEST_METHOD_ORIGINAL;
|
|
18
|
+
exports.ATTR_HTTP_RESPONSE_STATUS_CODE = ATTR_HTTP_RESPONSE_STATUS_CODE;
|
|
19
|
+
exports.ATTR_NETWORK_PEER_ADDRESS = ATTR_NETWORK_PEER_ADDRESS;
|
|
20
|
+
exports.ATTR_NETWORK_PEER_PORT = ATTR_NETWORK_PEER_PORT;
|
|
21
|
+
exports.ATTR_SERVER_ADDRESS = ATTR_SERVER_ADDRESS;
|
|
22
|
+
exports.ATTR_SERVER_PORT = ATTR_SERVER_PORT;
|
|
23
|
+
exports.ATTR_URL_FULL = ATTR_URL_FULL;
|
|
24
|
+
exports.ATTR_URL_PATH = ATTR_URL_PATH;
|
|
25
|
+
exports.ATTR_URL_QUERY = ATTR_URL_QUERY;
|
|
26
|
+
exports.ATTR_URL_SCHEME = ATTR_URL_SCHEME;
|
|
27
|
+
exports.ATTR_USER_AGENT_ORIGINAL = ATTR_USER_AGENT_ORIGINAL;
|
|
28
|
+
//# sourceMappingURL=semconv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semconv.js","sources":["../../../../../src/integrations/node-fetch/vendored/semconv.ts"],"sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n *\n * NOTICE from the Sentry authors:\n * - Vendored from: https://github.com/open-telemetry/opentelemetry-js-contrib/tree/ed97091c9890dd18e52759f2ea98e9d7593b3ae4/packages/instrumentation-undici\n * - Upstream version: @opentelemetry/instrumentation-undici@0.24.0\n * - The semantic-convention constants this package emits, inlined from\n * `@opentelemetry/semantic-conventions` (matching the sibling vendored dirs).\n */\n\nexport const ATTR_HTTP_REQUEST_METHOD = 'http.request.method' as const;\nexport const ATTR_HTTP_REQUEST_METHOD_ORIGINAL = 'http.request.method_original' as const;\nexport const ATTR_HTTP_RESPONSE_STATUS_CODE = 'http.response.status_code' as const;\nexport const ATTR_NETWORK_PEER_ADDRESS = 'network.peer.address' as const;\nexport const ATTR_NETWORK_PEER_PORT = 'network.peer.port' as const;\nexport const ATTR_SERVER_ADDRESS = 'server.address' as const;\nexport const ATTR_SERVER_PORT = 'server.port' as const;\nexport const ATTR_URL_FULL = 'url.full' as const;\nexport const ATTR_URL_PATH = 'url.path' as const;\nexport const ATTR_URL_QUERY = 'url.query' as const;\nexport const ATTR_URL_SCHEME = 'url.scheme' as const;\nexport const ATTR_USER_AGENT_ORIGINAL = 'user_agent.original' as const;\n"],"names":[],"mappings":";;AAWO,MAAM,wBAAA,GAA2B;AACjC,MAAM,iCAAA,GAAoC;AAC1C,MAAM,8BAAA,GAAiC;AACvC,MAAM,yBAAA,GAA4B;AAClC,MAAM,sBAAA,GAAyB;AAC/B,MAAM,mBAAA,GAAsB;AAC5B,MAAM,gBAAA,GAAmB;AACzB,MAAM,aAAA,GAAgB;AACtB,MAAM,aAAA,GAAgB;AACtB,MAAM,cAAA,GAAiB;AACvB,MAAM,eAAA,GAAkB;AACxB,MAAM,wBAAA,GAA2B;;;;;;;;;;;;;;;"}
|