@sentry/opentelemetry 10.59.0 → 10.60.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.browser.js +1 -1
- package/build/cjs/index.js +1 -1
- package/build/cjs/{resource-D2T3VSoy.js → resource-DEULI4zI.js} +30 -7
- package/build/{esm/resource-P9iYHxcD.js.map → cjs/resource-DEULI4zI.js.map} +1 -1
- package/build/esm/index.browser.js +1 -1
- package/build/esm/index.js +2 -2
- package/build/esm/package.json +1 -1
- package/build/esm/{resource-P9iYHxcD.js → resource-PMlHXvcP.js} +31 -8
- package/build/{cjs/resource-D2T3VSoy.js.map → esm/resource-PMlHXvcP.js.map} +1 -1
- package/build/types/spanProcessor.d.ts +4 -0
- package/build/types/spanProcessor.d.ts.map +1 -1
- package/build/types-ts3.8/spanProcessor.d.ts +4 -0
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
3
|
const core = require('@sentry/core');
|
|
4
|
-
const resource = require('./resource-
|
|
4
|
+
const resource = require('./resource-DEULI4zI.js');
|
|
5
5
|
require('@opentelemetry/api');
|
|
6
6
|
require('@sentry/conventions/attributes');
|
|
7
7
|
require('@opentelemetry/core');
|
package/build/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
-
const resource = require('./resource-
|
|
3
|
+
const resource = require('./resource-DEULI4zI.js');
|
|
4
4
|
const core = require('@sentry/core');
|
|
5
5
|
const api = require('@opentelemetry/api');
|
|
6
6
|
const node_async_hooks = require('node:async_hooks');
|
|
@@ -1303,8 +1303,13 @@ function getData(span) {
|
|
|
1303
1303
|
|
|
1304
1304
|
class SentrySpanProcessor {
|
|
1305
1305
|
constructor(options) {
|
|
1306
|
+
this._unsubscribePreprocessSpan = void 0;
|
|
1306
1307
|
setIsSetup("SentrySpanProcessor");
|
|
1307
1308
|
this._exporter = new SentrySpanExporter(options);
|
|
1309
|
+
this._client = options?.client ?? core.getClient();
|
|
1310
|
+
if (this._client && core.hasSpanStreamingEnabled(this._client)) {
|
|
1311
|
+
this._unsubscribePreprocessSpan = this._client.on("preprocessSpan", backfillStreamedSpanDataFromOtel);
|
|
1312
|
+
}
|
|
1308
1313
|
}
|
|
1309
1314
|
/**
|
|
1310
1315
|
* @inheritDoc
|
|
@@ -1316,6 +1321,7 @@ class SentrySpanProcessor {
|
|
|
1316
1321
|
* @inheritDoc
|
|
1317
1322
|
*/
|
|
1318
1323
|
async shutdown() {
|
|
1324
|
+
this._unsubscribePreprocessSpan?.();
|
|
1319
1325
|
this._exporter.clear();
|
|
1320
1326
|
}
|
|
1321
1327
|
/**
|
|
@@ -1340,21 +1346,38 @@ class SentrySpanProcessor {
|
|
|
1340
1346
|
core.setCapturedScopesOnSpan(span, scopes.scope, scopes.isolationScope);
|
|
1341
1347
|
}
|
|
1342
1348
|
core.logSpanStart(span);
|
|
1343
|
-
|
|
1344
|
-
client?.emit("spanStart", span);
|
|
1349
|
+
this._client?.emit("spanStart", span);
|
|
1345
1350
|
}
|
|
1346
1351
|
/** @inheritDoc */
|
|
1347
1352
|
onEnd(span) {
|
|
1348
1353
|
core.logSpanEnd(span);
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
client.emit("afterSpanEnd", span);
|
|
1354
|
+
this._client?.emit("spanEnd", span);
|
|
1355
|
+
if (this._client && core.hasSpanStreamingEnabled(this._client)) {
|
|
1356
|
+
this._client.emit("afterSpanEnd", span);
|
|
1353
1357
|
} else {
|
|
1354
1358
|
this._exporter.export(span);
|
|
1355
1359
|
}
|
|
1356
1360
|
}
|
|
1357
1361
|
}
|
|
1362
|
+
function backfillStreamedSpanDataFromOtel(spanJSON, hint) {
|
|
1363
|
+
const attributes = spanJSON.attributes;
|
|
1364
|
+
if (!attributes) {
|
|
1365
|
+
return;
|
|
1366
|
+
}
|
|
1367
|
+
const kind = hint?.spanKind ?? api.SpanKind.INTERNAL;
|
|
1368
|
+
const { op, description, source, data } = inferSpanData(spanJSON.name, attributes, kind);
|
|
1369
|
+
spanJSON.name = description;
|
|
1370
|
+
core.safeSetSpanJSONAttributes(spanJSON, {
|
|
1371
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_OP]: op,
|
|
1372
|
+
[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,
|
|
1373
|
+
...data
|
|
1374
|
+
});
|
|
1375
|
+
if (kind !== api.SpanKind.INTERNAL) {
|
|
1376
|
+
core.safeSetSpanJSONAttributes(spanJSON, {
|
|
1377
|
+
"otel.kind": api.SpanKind[kind]
|
|
1378
|
+
});
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1358
1381
|
|
|
1359
1382
|
class SentrySampler {
|
|
1360
1383
|
constructor(client) {
|
|
@@ -1663,4 +1686,4 @@ exports.withActiveSpan = withActiveSpan;
|
|
|
1663
1686
|
exports.wrapClientClass = wrapClientClass;
|
|
1664
1687
|
exports.wrapContextManagerClass = wrapContextManagerClass;
|
|
1665
1688
|
exports.wrapSamplingDecision = wrapSamplingDecision;
|
|
1666
|
-
//# sourceMappingURL=resource-
|
|
1689
|
+
//# sourceMappingURL=resource-DEULI4zI.js.map
|