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