@sentry/opentelemetry 8.43.0 → 8.45.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.
@@ -1678,7 +1678,9 @@ class SentrySpanExporter {
1678
1678
  const remainingOpenSpanCount = finishedSpans.length - sentSpanCount;
1679
1679
 
1680
1680
  DEBUG_BUILD &&
1681
- logger.log(`SpanExporter exported ${sentSpanCount} spans, ${remainingOpenSpanCount} unsent spans remaining`);
1681
+ logger.log(
1682
+ `SpanExporter exported ${sentSpanCount} spans, ${remainingOpenSpanCount} spans are waiting for their parent spans to finish`,
1683
+ );
1682
1684
 
1683
1685
  sentSpans.forEach(span => {
1684
1686
  const bucketEntry = this._spansToBucketEntry.get(span);
@@ -1766,6 +1768,7 @@ function parseSpan(span) {
1766
1768
  return { origin, op, source };
1767
1769
  }
1768
1770
 
1771
+ /** Exported only for tests. */
1769
1772
  function createTransactionForOtelSpan(span) {
1770
1773
  const { op, description, data, origin = 'manual', source } = getSpanData(span);
1771
1774
  const capturedSpanScopes = getCapturedScopesOnSpan(span );
@@ -1802,12 +1805,16 @@ function createTransactionForOtelSpan(span) {
1802
1805
  status: getStatusMessage(status), // As per protocol, span status is allowed to be undefined
1803
1806
  });
1804
1807
 
1805
- const transactionEvent = {
1808
+ const statusCode = attributes[ATTR_HTTP_RESPONSE_STATUS_CODE];
1809
+ const responseContext = typeof statusCode === 'number' ? { response: { status_code: statusCode } } : undefined;
1810
+
1811
+ const transactionEvent = dropUndefinedKeys({
1806
1812
  contexts: {
1807
1813
  trace: traceContext,
1808
1814
  otel: {
1809
1815
  resource: span.resource.attributes,
1810
1816
  },
1817
+ ...responseContext,
1811
1818
  },
1812
1819
  spans: [],
1813
1820
  start_timestamp: spanTimeInputToSeconds(span.startTime),
@@ -1828,7 +1835,7 @@ function createTransactionForOtelSpan(span) {
1828
1835
  },
1829
1836
  }),
1830
1837
  _metrics_summary: getMetricSummaryJsonForSpan(span ),
1831
- };
1838
+ });
1832
1839
 
1833
1840
  return transactionEvent;
1834
1841
  }