@sentry/opentelemetry 8.11.0 → 8.12.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/cjs/index.js +7 -5
- package/cjs/index.js.map +1 -1
- package/esm/index.js +7 -5
- package/esm/index.js.map +1 -1
- package/package.json +4 -4
- package/types/spanExporter.d.ts +4 -1
- package/types/spanExporter.d.ts.map +1 -1
- package/types/spanProcessor.d.ts +3 -1
- package/types/spanProcessor.d.ts.map +1 -1
- package/types-ts3.8/spanExporter.d.ts +4 -1
- package/types-ts3.8/spanProcessor.d.ts +3 -1
package/esm/index.js
CHANGED
|
@@ -1468,14 +1468,16 @@ function inferStatusFromAttributes(attributes) {
|
|
|
1468
1468
|
function _optionalChain$2(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
1469
1469
|
|
|
1470
1470
|
const MAX_SPAN_COUNT = 1000;
|
|
1471
|
+
const DEFAULT_TIMEOUT = 300; // 5 min
|
|
1471
1472
|
|
|
1472
1473
|
/**
|
|
1473
1474
|
* A Sentry-specific exporter that converts OpenTelemetry Spans to Sentry Spans & Transactions.
|
|
1474
1475
|
*/
|
|
1475
1476
|
class SentrySpanExporter {
|
|
1476
1477
|
|
|
1477
|
-
constructor() {
|
|
1478
|
+
constructor(options) {
|
|
1478
1479
|
this._finishedSpans = [];
|
|
1480
|
+
this._timeout = _optionalChain$2([options, 'optionalAccess', _ => _.timeout]) || DEFAULT_TIMEOUT;
|
|
1479
1481
|
}
|
|
1480
1482
|
|
|
1481
1483
|
/** Export a single span. */
|
|
@@ -1536,7 +1538,7 @@ class SentrySpanExporter {
|
|
|
1536
1538
|
*/
|
|
1537
1539
|
_cleanupOldSpans(spans = this._finishedSpans) {
|
|
1538
1540
|
this._finishedSpans = spans.filter(span => {
|
|
1539
|
-
const shouldDrop = shouldCleanupSpan(span,
|
|
1541
|
+
const shouldDrop = shouldCleanupSpan(span, this._timeout);
|
|
1540
1542
|
DEBUG_BUILD &&
|
|
1541
1543
|
shouldDrop &&
|
|
1542
1544
|
logger.log(
|
|
@@ -1636,7 +1638,7 @@ function createTransactionForOtelSpan(span) {
|
|
|
1636
1638
|
|
|
1637
1639
|
const { traceId: trace_id, spanId: span_id } = span.spanContext();
|
|
1638
1640
|
|
|
1639
|
-
const parentSpanIdFromTraceState = _optionalChain$2([span, 'access',
|
|
1641
|
+
const parentSpanIdFromTraceState = _optionalChain$2([span, 'access', _2 => _2.spanContext, 'call', _3 => _3(), 'access', _4 => _4.traceState, 'optionalAccess', _5 => _5.get, 'call', _6 => _6(SENTRY_TRACE_STATE_PARENT_SPAN_ID)]);
|
|
1640
1642
|
|
|
1641
1643
|
// If parentSpanIdFromTraceState is defined at all, we want it to take presedence
|
|
1642
1644
|
// In that case, an empty string should be interpreted as "no parent span id",
|
|
@@ -1854,9 +1856,9 @@ function onSpanEnd(span) {
|
|
|
1854
1856
|
*/
|
|
1855
1857
|
class SentrySpanProcessor {
|
|
1856
1858
|
|
|
1857
|
-
constructor() {
|
|
1859
|
+
constructor(options) {
|
|
1858
1860
|
setIsSetup('SentrySpanProcessor');
|
|
1859
|
-
this._exporter = new SentrySpanExporter();
|
|
1861
|
+
this._exporter = new SentrySpanExporter(options);
|
|
1860
1862
|
}
|
|
1861
1863
|
|
|
1862
1864
|
/**
|