@sentry/opentelemetry 8.14.0 → 8.16.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 +21 -13
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.js +22 -14
- package/build/esm/index.js.map +1 -1
- package/build/types/utils/parseSpanDescription.d.ts +1 -1
- package/build/types/utils/parseSpanDescription.d.ts.map +1 -1
- package/build/types-ts3.8/utils/parseSpanDescription.d.ts +1 -1
- package/package.json +4 -4
- package/build/types/utils/convertOtelTimeToSeconds.d.ts +0 -3
- package/build/types/utils/convertOtelTimeToSeconds.d.ts.map +0 -1
- package/build/types-ts3.8/utils/convertOtelTimeToSeconds.d.ts +0 -6
package/build/cjs/index.js
CHANGED
|
@@ -269,6 +269,19 @@ function parseSpanDescription(span) {
|
|
|
269
269
|
const attributes = spanHasAttributes(span) ? span.attributes : {};
|
|
270
270
|
const name = spanHasName(span) ? span.name : '<unknown>';
|
|
271
271
|
|
|
272
|
+
// This attribute is intentionally exported as a SEMATTR constant because it should stay intimite API
|
|
273
|
+
if (attributes['sentry.skip_span_data_inference']) {
|
|
274
|
+
return {
|
|
275
|
+
op: undefined,
|
|
276
|
+
description: name,
|
|
277
|
+
source: 'custom',
|
|
278
|
+
data: {
|
|
279
|
+
// Suggest to callers of `parseSpanDescription` to wipe the hint because it is unnecessary data in the end.
|
|
280
|
+
'sentry.skip_span_data_inference': undefined,
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
|
|
272
285
|
// if http.method exists, this is an http request span
|
|
273
286
|
//
|
|
274
287
|
// TODO: Referencing `http.request.method` is a temporary workaround until the semantic
|
|
@@ -619,7 +632,7 @@ class SentryPropagator extends core$1.W3CBaggagePropagator {
|
|
|
619
632
|
|
|
620
633
|
const propagationContext = utils.propagationContextFromHeaders(sentryTrace, baggage);
|
|
621
634
|
|
|
622
|
-
// Add remote parent span context
|
|
635
|
+
// Add remote parent span context
|
|
623
636
|
const ctxWithSpanContext = getContextWithRemoteActiveSpan(context, { sentryTrace, baggage });
|
|
624
637
|
|
|
625
638
|
// Also update the scope on the context (to be sure this is picked up everywhere)
|
|
@@ -1253,8 +1266,8 @@ function wrapContextManagerClass(
|
|
|
1253
1266
|
|
|
1254
1267
|
// @ts-expect-error TS does not like this, but we know this is fine
|
|
1255
1268
|
class SentryContextManager extends ContextManagerClass {
|
|
1256
|
-
constructor() {
|
|
1257
|
-
super();
|
|
1269
|
+
constructor(...args) {
|
|
1270
|
+
super(...args);
|
|
1258
1271
|
setIsSetup('SentryContextManager');
|
|
1259
1272
|
}
|
|
1260
1273
|
/**
|
|
@@ -1300,11 +1313,6 @@ function wrapContextManagerClass(
|
|
|
1300
1313
|
/** If this attribute is true, it means that the parent is a remote span. */
|
|
1301
1314
|
const SEMANTIC_ATTRIBUTE_SENTRY_PARENT_IS_REMOTE = 'sentry.parentIsRemote';
|
|
1302
1315
|
|
|
1303
|
-
/** Convert an OTEL time to seconds */
|
|
1304
|
-
function convertOtelTimeToSeconds([seconds, nano]) {
|
|
1305
|
-
return seconds + nano / 1000000000;
|
|
1306
|
-
}
|
|
1307
|
-
|
|
1308
1316
|
/**
|
|
1309
1317
|
* This function runs through a list of OTEL Spans, and wraps them in an `SpanNode`
|
|
1310
1318
|
* where each node holds a reference to their parent node.
|
|
@@ -1611,7 +1619,7 @@ function getCompletedRootNodes(nodes) {
|
|
|
1611
1619
|
|
|
1612
1620
|
function shouldCleanupSpan(span, maxStartTimeOffsetSeconds) {
|
|
1613
1621
|
const cutoff = Date.now() / 1000 - maxStartTimeOffsetSeconds;
|
|
1614
|
-
return
|
|
1622
|
+
return core.spanTimeInputToSeconds(span.startTime) < cutoff;
|
|
1615
1623
|
}
|
|
1616
1624
|
|
|
1617
1625
|
function parseSpan(span) {
|
|
@@ -1671,8 +1679,8 @@ function createTransactionForOtelSpan(span) {
|
|
|
1671
1679
|
},
|
|
1672
1680
|
},
|
|
1673
1681
|
spans: [],
|
|
1674
|
-
start_timestamp:
|
|
1675
|
-
timestamp:
|
|
1682
|
+
start_timestamp: core.spanTimeInputToSeconds(span.startTime),
|
|
1683
|
+
timestamp: core.spanTimeInputToSeconds(span.endTime),
|
|
1676
1684
|
transaction: description,
|
|
1677
1685
|
type: 'transaction',
|
|
1678
1686
|
sdkProcessingMetadata: {
|
|
@@ -1729,9 +1737,9 @@ function createAndFinishSpanForOtelSpan(node, spans, remaining) {
|
|
|
1729
1737
|
data: allData,
|
|
1730
1738
|
description,
|
|
1731
1739
|
parent_span_id: parentSpanId,
|
|
1732
|
-
start_timestamp:
|
|
1740
|
+
start_timestamp: core.spanTimeInputToSeconds(startTime),
|
|
1733
1741
|
// This is [0,0] by default in OTEL, in which case we want to interpret this as no end time
|
|
1734
|
-
timestamp:
|
|
1742
|
+
timestamp: core.spanTimeInputToSeconds(endTime) || undefined,
|
|
1735
1743
|
status: core.getStatusMessage(status), // As per protocol, span status is allowed to be undefined
|
|
1736
1744
|
op,
|
|
1737
1745
|
origin,
|