diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingCoreIntegration/init.js b/dev-packages/browser-integration-tests/suites/tracing/browserTracingCoreIntegration/init.js new file mode 100644 index 000000000000..a6ddc3fe028f --- /dev/null +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingCoreIntegration/init.js @@ -0,0 +1,10 @@ +import * as Sentry from '@sentry/browser'; + +window.Sentry = Sentry; + +Sentry.init({ + dsn: 'https://public@dsn.ingest.sentry.io/1337', + integrations: [Sentry.browserTracingCoreIntegration(), Sentry.fetchTracingIntegration()], + tracePropagationTargets: ['http://sentry-test-site.example'], + tracesSampleRate: 1, +}); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingCoreIntegration/subject.js b/dev-packages/browser-integration-tests/suites/tracing/browserTracingCoreIntegration/subject.js new file mode 100644 index 000000000000..f5e7312a1961 --- /dev/null +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingCoreIntegration/subject.js @@ -0,0 +1 @@ +fetch('http://sentry-test-site.example/0'); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingCoreIntegration/test.ts b/dev-packages/browser-integration-tests/suites/tracing/browserTracingCoreIntegration/test.ts new file mode 100644 index 000000000000..fdeccdc4d035 --- /dev/null +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingCoreIntegration/test.ts @@ -0,0 +1,33 @@ +import { expect } from '@playwright/test'; +import { sentryTest } from '../../../utils/fixtures'; +import { shouldSkipTracingTest } from '../../../utils/helpers'; +import { collectStreamedSpans, getSpanOp, waitForStreamedSpan } from '../../../utils/spanUtils'; + +sentryTest( + 'composes browserTracingCoreIntegration() with only the standalone integrations passed to it', + async ({ getLocalTestUrl, page }) => { + sentryTest.skip(shouldSkipTracingTest()); + + await page.route('http://sentry-test-site.example/*', route => route.fulfill({ body: 'ok' })); + + const url = await getLocalTestUrl({ testDir: __dirname }); + + const spans = collectStreamedSpans(page); + const pageloadPromise = waitForStreamedSpan(page, span => span.is_segment && getSpanOp(span) === 'pageload'); + + await page.goto(url); + + const pageloadSpan = await pageloadPromise; + await page.evaluate(() => (window as any).Sentry.flush()); + + const requestSpans = spans.filter(span => getSpanOp(span) === 'http.client'); + expect(requestSpans).toHaveLength(1); + expect(requestSpans[0]).toMatchObject({ + parent_span_id: pageloadSpan.span_id, + trace_id: pageloadSpan.trace_id, + }); + + // `resourcesIntegration` was not added, so the page's own script loads must not produce spans. + expect(spans.filter(span => getSpanOp(span)?.startsWith('resource.'))).toHaveLength(0); + }, +); diff --git a/packages/browser/src/index.bundle.feedback.ts b/packages/browser/src/index.bundle.feedback.ts index 2a1e199c96a6..dfa006e5a15a 100644 --- a/packages/browser/src/index.bundle.feedback.ts +++ b/packages/browser/src/index.bundle.feedback.ts @@ -1,5 +1,11 @@ import { browserTracingIntegrationShim, + browserTracingCoreIntegrationShim, + longTasksIntegrationShim, + resourcesIntegrationShim, + fetchTracingIntegrationShim, + xhrTracingIntegrationShim, + linkedTracesIntegrationShim, consoleLoggingIntegrationShim, elementTimingIntegrationShim, loggerShim, @@ -18,6 +24,12 @@ export { getFeedback, sendFeedback } from '@sentry/feedback'; export { browserTracingIntegrationShim as browserTracingIntegration, + browserTracingCoreIntegrationShim as browserTracingCoreIntegration, + longTasksIntegrationShim as longTasksIntegration, + resourcesIntegrationShim as resourcesIntegration, + fetchTracingIntegrationShim as fetchTracingIntegration, + xhrTracingIntegrationShim as xhrTracingIntegration, + linkedTracesIntegrationShim as linkedTracesIntegration, elementTimingIntegrationShim as elementTimingIntegration, feedbackAsyncIntegration as feedbackAsyncIntegration, feedbackAsyncIntegration as feedbackIntegration, diff --git a/packages/browser/src/index.bundle.logs.metrics.ts b/packages/browser/src/index.bundle.logs.metrics.ts index 2a5db34d2503..b7c7bd260939 100644 --- a/packages/browser/src/index.bundle.logs.metrics.ts +++ b/packages/browser/src/index.bundle.logs.metrics.ts @@ -1,5 +1,11 @@ import { browserTracingIntegrationShim, + browserTracingCoreIntegrationShim, + longTasksIntegrationShim, + resourcesIntegrationShim, + fetchTracingIntegrationShim, + xhrTracingIntegrationShim, + linkedTracesIntegrationShim, feedbackIntegrationShim, replayIntegrationShim, spanStreamingIntegrationShim, @@ -14,6 +20,12 @@ export { elementTimingIntegration } from '@sentry/browser-utils'; export { browserTracingIntegrationShim as browserTracingIntegration, + browserTracingCoreIntegrationShim as browserTracingCoreIntegration, + longTasksIntegrationShim as longTasksIntegration, + resourcesIntegrationShim as resourcesIntegration, + fetchTracingIntegrationShim as fetchTracingIntegration, + xhrTracingIntegrationShim as xhrTracingIntegration, + linkedTracesIntegrationShim as linkedTracesIntegration, feedbackIntegrationShim as feedbackAsyncIntegration, feedbackIntegrationShim as feedbackIntegration, replayIntegrationShim as replayIntegration, diff --git a/packages/browser/src/index.bundle.replay.feedback.ts b/packages/browser/src/index.bundle.replay.feedback.ts index 8d6ee4997d80..48c836f83742 100644 --- a/packages/browser/src/index.bundle.replay.feedback.ts +++ b/packages/browser/src/index.bundle.replay.feedback.ts @@ -1,5 +1,11 @@ import { browserTracingIntegrationShim, + browserTracingCoreIntegrationShim, + longTasksIntegrationShim, + resourcesIntegrationShim, + fetchTracingIntegrationShim, + xhrTracingIntegrationShim, + linkedTracesIntegrationShim, consoleLoggingIntegrationShim, elementTimingIntegrationShim, loggerShim, @@ -17,6 +23,12 @@ export { getFeedback, sendFeedback } from '@sentry/feedback'; export { browserTracingIntegrationShim as browserTracingIntegration, + browserTracingCoreIntegrationShim as browserTracingCoreIntegration, + longTasksIntegrationShim as longTasksIntegration, + resourcesIntegrationShim as resourcesIntegration, + fetchTracingIntegrationShim as fetchTracingIntegration, + xhrTracingIntegrationShim as xhrTracingIntegration, + linkedTracesIntegrationShim as linkedTracesIntegration, elementTimingIntegrationShim as elementTimingIntegration, feedbackAsyncIntegration as feedbackAsyncIntegration, feedbackAsyncIntegration as feedbackIntegration, diff --git a/packages/browser/src/index.bundle.replay.logs.metrics.ts b/packages/browser/src/index.bundle.replay.logs.metrics.ts index cb481337da9f..4126d3176cde 100644 --- a/packages/browser/src/index.bundle.replay.logs.metrics.ts +++ b/packages/browser/src/index.bundle.replay.logs.metrics.ts @@ -1,5 +1,11 @@ import { browserTracingIntegrationShim, + browserTracingCoreIntegrationShim, + longTasksIntegrationShim, + resourcesIntegrationShim, + fetchTracingIntegrationShim, + xhrTracingIntegrationShim, + linkedTracesIntegrationShim, feedbackIntegrationShim, spanStreamingIntegrationShim, fetchStreamPerformanceIntegrationShim, @@ -15,6 +21,12 @@ export { elementTimingIntegration } from '@sentry/browser-utils'; export { browserTracingIntegrationShim as browserTracingIntegration, + browserTracingCoreIntegrationShim as browserTracingCoreIntegration, + longTasksIntegrationShim as longTasksIntegration, + resourcesIntegrationShim as resourcesIntegration, + fetchTracingIntegrationShim as fetchTracingIntegration, + xhrTracingIntegrationShim as xhrTracingIntegration, + linkedTracesIntegrationShim as linkedTracesIntegration, feedbackIntegrationShim as feedbackAsyncIntegration, feedbackIntegrationShim as feedbackIntegration, spanStreamingIntegrationShim as spanStreamingIntegration, diff --git a/packages/browser/src/index.bundle.replay.ts b/packages/browser/src/index.bundle.replay.ts index 8a048df7531f..eac2a1e0612f 100644 --- a/packages/browser/src/index.bundle.replay.ts +++ b/packages/browser/src/index.bundle.replay.ts @@ -1,5 +1,11 @@ import { browserTracingIntegrationShim, + browserTracingCoreIntegrationShim, + longTasksIntegrationShim, + resourcesIntegrationShim, + fetchTracingIntegrationShim, + xhrTracingIntegrationShim, + linkedTracesIntegrationShim, consoleLoggingIntegrationShim, elementTimingIntegrationShim, feedbackIntegrationShim, @@ -17,6 +23,12 @@ export { replayIntegration, getReplay } from '@sentry/replay'; export { browserTracingIntegrationShim as browserTracingIntegration, + browserTracingCoreIntegrationShim as browserTracingCoreIntegration, + longTasksIntegrationShim as longTasksIntegration, + resourcesIntegrationShim as resourcesIntegration, + fetchTracingIntegrationShim as fetchTracingIntegration, + xhrTracingIntegrationShim as xhrTracingIntegration, + linkedTracesIntegrationShim as linkedTracesIntegration, elementTimingIntegrationShim as elementTimingIntegration, feedbackIntegrationShim as feedbackAsyncIntegration, feedbackIntegrationShim as feedbackIntegration, diff --git a/packages/browser/src/index.bundle.tracing.logs.metrics.ts b/packages/browser/src/index.bundle.tracing.logs.metrics.ts index 477fa381f93c..502935da0583 100644 --- a/packages/browser/src/index.bundle.tracing.logs.metrics.ts +++ b/packages/browser/src/index.bundle.tracing.logs.metrics.ts @@ -19,6 +19,7 @@ export { export { startSpan, startInactiveSpan, startSpanManual } from '@sentry/core/browser'; export { + browserTracingCoreIntegration, browserTracingIntegration, startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan, @@ -30,6 +31,11 @@ export { setActiveSpanInBrowser } from './tracing/setActiveSpan'; export { fetchStreamPerformanceIntegration } from './integrations/fetchStreamPerformance'; export { webVitalsIntegration } from './integrations/webVitals'; +export { longTasksIntegration } from './integrations/longTasks'; +export { resourcesIntegration } from './integrations/resources'; +export { fetchTracingIntegration } from './integrations/fetchTracing'; +export { xhrTracingIntegration } from './integrations/xhrTracing'; +export { linkedTracesIntegration } from './integrations/linkedTraces'; export { feedbackIntegrationShim as feedbackAsyncIntegration, diff --git a/packages/browser/src/index.bundle.tracing.replay.feedback.logs.metrics.ts b/packages/browser/src/index.bundle.tracing.replay.feedback.logs.metrics.ts index 57127dbee2ac..0bf4430a3b9c 100644 --- a/packages/browser/src/index.bundle.tracing.replay.feedback.logs.metrics.ts +++ b/packages/browser/src/index.bundle.tracing.replay.feedback.logs.metrics.ts @@ -20,6 +20,7 @@ export { export { startSpan, startInactiveSpan, startSpanManual } from '@sentry/core/browser'; export { + browserTracingCoreIntegration, browserTracingIntegration, startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan, @@ -31,6 +32,11 @@ export { setActiveSpanInBrowser } from './tracing/setActiveSpan'; export { fetchStreamPerformanceIntegration } from './integrations/fetchStreamPerformance'; export { webVitalsIntegration } from './integrations/webVitals'; +export { longTasksIntegration } from './integrations/longTasks'; +export { resourcesIntegration } from './integrations/resources'; +export { fetchTracingIntegration } from './integrations/fetchTracing'; +export { xhrTracingIntegration } from './integrations/xhrTracing'; +export { linkedTracesIntegration } from './integrations/linkedTraces'; export { getFeedback, sendFeedback } from '@sentry/feedback'; diff --git a/packages/browser/src/index.bundle.tracing.replay.feedback.ts b/packages/browser/src/index.bundle.tracing.replay.feedback.ts index 4bae50e0fe49..9413f780bfb8 100644 --- a/packages/browser/src/index.bundle.tracing.replay.feedback.ts +++ b/packages/browser/src/index.bundle.tracing.replay.feedback.ts @@ -25,6 +25,7 @@ export { export { startSpan, startInactiveSpan, startSpanManual } from '@sentry/core/browser'; export { + browserTracingCoreIntegration, browserTracingIntegration, startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan, @@ -37,6 +38,11 @@ export { reportPageLoaded } from './tracing/reportPageLoaded'; export { fetchStreamPerformanceIntegration } from './integrations/fetchStreamPerformance'; export { webVitalsIntegration } from './integrations/webVitals'; +export { longTasksIntegration } from './integrations/longTasks'; +export { resourcesIntegration } from './integrations/resources'; +export { fetchTracingIntegration } from './integrations/fetchTracing'; +export { xhrTracingIntegration } from './integrations/xhrTracing'; +export { linkedTracesIntegration } from './integrations/linkedTraces'; export { getFeedback, sendFeedback } from '@sentry/feedback'; diff --git a/packages/browser/src/index.bundle.tracing.replay.logs.metrics.ts b/packages/browser/src/index.bundle.tracing.replay.logs.metrics.ts index 29dc32ac035b..10836b1b2f91 100644 --- a/packages/browser/src/index.bundle.tracing.replay.logs.metrics.ts +++ b/packages/browser/src/index.bundle.tracing.replay.logs.metrics.ts @@ -19,6 +19,7 @@ export { export { startSpan, startInactiveSpan, startSpanManual } from '@sentry/core/browser'; export { + browserTracingCoreIntegration, browserTracingIntegration, startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan, @@ -30,6 +31,11 @@ export { setActiveSpanInBrowser } from './tracing/setActiveSpan'; export { fetchStreamPerformanceIntegration } from './integrations/fetchStreamPerformance'; export { webVitalsIntegration } from './integrations/webVitals'; +export { longTasksIntegration } from './integrations/longTasks'; +export { resourcesIntegration } from './integrations/resources'; +export { fetchTracingIntegration } from './integrations/fetchTracing'; +export { xhrTracingIntegration } from './integrations/xhrTracing'; +export { linkedTracesIntegration } from './integrations/linkedTraces'; export { feedbackIntegrationShim as feedbackAsyncIntegration, feedbackIntegrationShim as feedbackIntegration }; diff --git a/packages/browser/src/index.bundle.tracing.replay.ts b/packages/browser/src/index.bundle.tracing.replay.ts index b1dd10ced028..43ec9cc5badd 100644 --- a/packages/browser/src/index.bundle.tracing.replay.ts +++ b/packages/browser/src/index.bundle.tracing.replay.ts @@ -25,6 +25,7 @@ export { export { startSpan, startInactiveSpan, startSpanManual } from '@sentry/core/browser'; export { + browserTracingCoreIntegration, browserTracingIntegration, startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan, @@ -36,6 +37,11 @@ export { setActiveSpanInBrowser } from './tracing/setActiveSpan'; export { fetchStreamPerformanceIntegration } from './integrations/fetchStreamPerformance'; export { webVitalsIntegration } from './integrations/webVitals'; +export { longTasksIntegration } from './integrations/longTasks'; +export { resourcesIntegration } from './integrations/resources'; +export { fetchTracingIntegration } from './integrations/fetchTracing'; +export { xhrTracingIntegration } from './integrations/xhrTracing'; +export { linkedTracesIntegration } from './integrations/linkedTraces'; export { feedbackIntegrationShim as feedbackAsyncIntegration, feedbackIntegrationShim as feedbackIntegration }; diff --git a/packages/browser/src/index.bundle.tracing.ts b/packages/browser/src/index.bundle.tracing.ts index ad4082623859..5c36ae6823fd 100644 --- a/packages/browser/src/index.bundle.tracing.ts +++ b/packages/browser/src/index.bundle.tracing.ts @@ -26,6 +26,7 @@ export { export { startSpan, startInactiveSpan, startSpanManual } from '@sentry/core/browser'; export { + browserTracingCoreIntegration, browserTracingIntegration, startBrowserTracingNavigationSpan, startBrowserTracingPageLoadSpan, @@ -38,6 +39,11 @@ export { reportPageLoaded } from './tracing/reportPageLoaded'; export { fetchStreamPerformanceIntegration } from './integrations/fetchStreamPerformance'; export { webVitalsIntegration } from './integrations/webVitals'; +export { longTasksIntegration } from './integrations/longTasks'; +export { resourcesIntegration } from './integrations/resources'; +export { fetchTracingIntegration } from './integrations/fetchTracing'; +export { xhrTracingIntegration } from './integrations/xhrTracing'; +export { linkedTracesIntegration } from './integrations/linkedTraces'; export { feedbackIntegrationShim as feedbackAsyncIntegration, diff --git a/packages/browser/src/index.bundle.ts b/packages/browser/src/index.bundle.ts index e71777c829c4..8363623b4a05 100644 --- a/packages/browser/src/index.bundle.ts +++ b/packages/browser/src/index.bundle.ts @@ -1,5 +1,11 @@ import { browserTracingIntegrationShim, + browserTracingCoreIntegrationShim, + longTasksIntegrationShim, + resourcesIntegrationShim, + fetchTracingIntegrationShim, + xhrTracingIntegrationShim, + linkedTracesIntegrationShim, consoleLoggingIntegrationShim, elementTimingIntegrationShim, feedbackIntegrationShim, @@ -16,6 +22,12 @@ export { consoleLoggingIntegrationShim as consoleLoggingIntegration, loggerShim export { browserTracingIntegrationShim as browserTracingIntegration, + browserTracingCoreIntegrationShim as browserTracingCoreIntegration, + longTasksIntegrationShim as longTasksIntegration, + resourcesIntegrationShim as resourcesIntegration, + fetchTracingIntegrationShim as fetchTracingIntegration, + xhrTracingIntegrationShim as xhrTracingIntegration, + linkedTracesIntegrationShim as linkedTracesIntegration, elementTimingIntegrationShim as elementTimingIntegration, feedbackIntegrationShim as feedbackAsyncIntegration, feedbackIntegrationShim as feedbackIntegration, diff --git a/packages/browser/test/index.bundle.feedback.test.ts b/packages/browser/test/index.bundle.feedback.test.ts index c404ca2aec94..4674213dab6e 100644 --- a/packages/browser/test/index.bundle.feedback.test.ts +++ b/packages/browser/test/index.bundle.feedback.test.ts @@ -1,10 +1,16 @@ import { + browserTracingCoreIntegrationShim, browserTracingIntegrationShim, consoleLoggingIntegrationShim, + fetchTracingIntegrationShim, + linkedTracesIntegrationShim, loggerShim, + longTasksIntegrationShim, metricsShim, replayIntegrationShim, + resourcesIntegrationShim, spanStreamingIntegrationShim, + xhrTracingIntegrationShim, } from '@sentry-internal/integration-shims'; import { describe, expect, it } from 'vitest'; import { feedbackAsyncIntegration } from '../src'; @@ -12,6 +18,13 @@ import * as FeedbackBundle from '../src/index.bundle.feedback'; describe('index.bundle.feedback', () => { it('has correct exports', () => { + expect(FeedbackBundle.browserTracingCoreIntegration).toBe(browserTracingCoreIntegrationShim); + expect(FeedbackBundle.longTasksIntegration).toBe(longTasksIntegrationShim); + expect(FeedbackBundle.resourcesIntegration).toBe(resourcesIntegrationShim); + expect(FeedbackBundle.fetchTracingIntegration).toBe(fetchTracingIntegrationShim); + expect(FeedbackBundle.xhrTracingIntegration).toBe(xhrTracingIntegrationShim); + expect(FeedbackBundle.linkedTracesIntegration).toBe(linkedTracesIntegrationShim); + expect(FeedbackBundle.browserTracingIntegration).toBe(browserTracingIntegrationShim); expect(FeedbackBundle.feedbackAsyncIntegration).toBe(feedbackAsyncIntegration); expect(FeedbackBundle.feedbackIntegration).toBe(feedbackAsyncIntegration); diff --git a/packages/browser/test/index.bundle.logs.metrics.test.ts b/packages/browser/test/index.bundle.logs.metrics.test.ts index 7d450dc1ced0..3e38173260d6 100644 --- a/packages/browser/test/index.bundle.logs.metrics.test.ts +++ b/packages/browser/test/index.bundle.logs.metrics.test.ts @@ -1,10 +1,25 @@ import { logger as coreLogger, metrics as coreMetrics } from '@sentry/core'; -import { spanStreamingIntegrationShim } from '@sentry-internal/integration-shims'; +import { + browserTracingCoreIntegrationShim, + fetchTracingIntegrationShim, + linkedTracesIntegrationShim, + longTasksIntegrationShim, + resourcesIntegrationShim, + spanStreamingIntegrationShim, + xhrTracingIntegrationShim, +} from '@sentry-internal/integration-shims'; import { describe, expect, it } from 'vitest'; import * as LogsMetricsBundle from '../src/index.bundle.logs.metrics'; describe('index.bundle.logs.metrics', () => { it('has correct exports', () => { + expect(LogsMetricsBundle.browserTracingCoreIntegration).toBe(browserTracingCoreIntegrationShim); + expect(LogsMetricsBundle.longTasksIntegration).toBe(longTasksIntegrationShim); + expect(LogsMetricsBundle.resourcesIntegration).toBe(resourcesIntegrationShim); + expect(LogsMetricsBundle.fetchTracingIntegration).toBe(fetchTracingIntegrationShim); + expect(LogsMetricsBundle.xhrTracingIntegration).toBe(xhrTracingIntegrationShim); + expect(LogsMetricsBundle.linkedTracesIntegration).toBe(linkedTracesIntegrationShim); + expect(LogsMetricsBundle.logger).toBe(coreLogger); expect(LogsMetricsBundle.metrics).toBe(coreMetrics); expect(LogsMetricsBundle.spanStreamingIntegration).toBe(spanStreamingIntegrationShim); diff --git a/packages/browser/test/index.bundle.replay.feedback.test.ts b/packages/browser/test/index.bundle.replay.feedback.test.ts index 79eceaa1feaa..729ce7e7441d 100644 --- a/packages/browser/test/index.bundle.replay.feedback.test.ts +++ b/packages/browser/test/index.bundle.replay.feedback.test.ts @@ -1,9 +1,15 @@ import { + browserTracingCoreIntegrationShim, browserTracingIntegrationShim, consoleLoggingIntegrationShim, + fetchTracingIntegrationShim, + linkedTracesIntegrationShim, loggerShim, + longTasksIntegrationShim, metricsShim, + resourcesIntegrationShim, spanStreamingIntegrationShim, + xhrTracingIntegrationShim, } from '@sentry-internal/integration-shims'; import { describe, expect, it } from 'vitest'; import { feedbackAsyncIntegration, replayIntegration } from '../src'; @@ -11,6 +17,13 @@ import * as ReplayFeedbackBundle from '../src/index.bundle.replay.feedback'; describe('index.bundle.replay.feedback', () => { it('has correct exports', () => { + expect(ReplayFeedbackBundle.browserTracingCoreIntegration).toBe(browserTracingCoreIntegrationShim); + expect(ReplayFeedbackBundle.longTasksIntegration).toBe(longTasksIntegrationShim); + expect(ReplayFeedbackBundle.resourcesIntegration).toBe(resourcesIntegrationShim); + expect(ReplayFeedbackBundle.fetchTracingIntegration).toBe(fetchTracingIntegrationShim); + expect(ReplayFeedbackBundle.xhrTracingIntegration).toBe(xhrTracingIntegrationShim); + expect(ReplayFeedbackBundle.linkedTracesIntegration).toBe(linkedTracesIntegrationShim); + expect(ReplayFeedbackBundle.browserTracingIntegration).toBe(browserTracingIntegrationShim); expect(ReplayFeedbackBundle.feedbackAsyncIntegration).toBe(feedbackAsyncIntegration); expect(ReplayFeedbackBundle.feedbackIntegration).toBe(feedbackAsyncIntegration); diff --git a/packages/browser/test/index.bundle.replay.logs.metrics.test.ts b/packages/browser/test/index.bundle.replay.logs.metrics.test.ts index d6bb995fae09..1fbc138e1927 100644 --- a/packages/browser/test/index.bundle.replay.logs.metrics.test.ts +++ b/packages/browser/test/index.bundle.replay.logs.metrics.test.ts @@ -1,8 +1,14 @@ import { logger as coreLogger, metrics as coreMetrics } from '@sentry/core'; import { + browserTracingCoreIntegrationShim, browserTracingIntegrationShim, feedbackIntegrationShim, + fetchTracingIntegrationShim, + linkedTracesIntegrationShim, + longTasksIntegrationShim, + resourcesIntegrationShim, spanStreamingIntegrationShim, + xhrTracingIntegrationShim, } from '@sentry-internal/integration-shims'; import { describe, expect, it } from 'vitest'; import { replayIntegration } from '../src'; @@ -10,6 +16,13 @@ import * as ReplayLogsMetricsBundle from '../src/index.bundle.replay.logs.metric describe('index.bundle.replay.logs.metrics', () => { it('has correct exports', () => { + expect(ReplayLogsMetricsBundle.browserTracingCoreIntegration).toBe(browserTracingCoreIntegrationShim); + expect(ReplayLogsMetricsBundle.longTasksIntegration).toBe(longTasksIntegrationShim); + expect(ReplayLogsMetricsBundle.resourcesIntegration).toBe(resourcesIntegrationShim); + expect(ReplayLogsMetricsBundle.fetchTracingIntegration).toBe(fetchTracingIntegrationShim); + expect(ReplayLogsMetricsBundle.xhrTracingIntegration).toBe(xhrTracingIntegrationShim); + expect(ReplayLogsMetricsBundle.linkedTracesIntegration).toBe(linkedTracesIntegrationShim); + expect(ReplayLogsMetricsBundle.browserTracingIntegration).toBe(browserTracingIntegrationShim); expect(ReplayLogsMetricsBundle.feedbackAsyncIntegration).toBe(feedbackIntegrationShim); expect(ReplayLogsMetricsBundle.feedbackIntegration).toBe(feedbackIntegrationShim); diff --git a/packages/browser/test/index.bundle.replay.test.ts b/packages/browser/test/index.bundle.replay.test.ts index 60517a37cf1b..2b995303a89d 100644 --- a/packages/browser/test/index.bundle.replay.test.ts +++ b/packages/browser/test/index.bundle.replay.test.ts @@ -1,10 +1,16 @@ import { + browserTracingCoreIntegrationShim, browserTracingIntegrationShim, consoleLoggingIntegrationShim, feedbackIntegrationShim, + fetchTracingIntegrationShim, + linkedTracesIntegrationShim, loggerShim, + longTasksIntegrationShim, metricsShim, + resourcesIntegrationShim, spanStreamingIntegrationShim, + xhrTracingIntegrationShim, } from '@sentry-internal/integration-shims'; import { describe, expect, it } from 'vitest'; import { replayIntegration } from '../src'; @@ -12,6 +18,13 @@ import * as ReplayBundle from '../src/index.bundle.replay'; describe('index.bundle.replay', () => { it('has correct exports', () => { + expect(ReplayBundle.browserTracingCoreIntegration).toBe(browserTracingCoreIntegrationShim); + expect(ReplayBundle.longTasksIntegration).toBe(longTasksIntegrationShim); + expect(ReplayBundle.resourcesIntegration).toBe(resourcesIntegrationShim); + expect(ReplayBundle.fetchTracingIntegration).toBe(fetchTracingIntegrationShim); + expect(ReplayBundle.xhrTracingIntegration).toBe(xhrTracingIntegrationShim); + expect(ReplayBundle.linkedTracesIntegration).toBe(linkedTracesIntegrationShim); + expect(ReplayBundle.browserTracingIntegration).toBe(browserTracingIntegrationShim); expect(ReplayBundle.feedbackAsyncIntegration).toBe(feedbackIntegrationShim); expect(ReplayBundle.feedbackIntegration).toBe(feedbackIntegrationShim); diff --git a/packages/browser/test/index.bundle.test.ts b/packages/browser/test/index.bundle.test.ts index 8803d2f649ec..461b1bf256ea 100644 --- a/packages/browser/test/index.bundle.test.ts +++ b/packages/browser/test/index.bundle.test.ts @@ -1,17 +1,30 @@ import { + browserTracingCoreIntegrationShim, browserTracingIntegrationShim, consoleLoggingIntegrationShim, feedbackIntegrationShim, + fetchTracingIntegrationShim, + linkedTracesIntegrationShim, loggerShim, + longTasksIntegrationShim, metricsShim, replayIntegrationShim, + resourcesIntegrationShim, spanStreamingIntegrationShim, + xhrTracingIntegrationShim, } from '@sentry-internal/integration-shims'; import { describe, expect, it } from 'vitest'; import * as Bundle from '../src/index.bundle'; describe('index.bundle', () => { it('has correct exports', () => { + expect(Bundle.browserTracingCoreIntegration).toBe(browserTracingCoreIntegrationShim); + expect(Bundle.longTasksIntegration).toBe(longTasksIntegrationShim); + expect(Bundle.resourcesIntegration).toBe(resourcesIntegrationShim); + expect(Bundle.fetchTracingIntegration).toBe(fetchTracingIntegrationShim); + expect(Bundle.xhrTracingIntegration).toBe(xhrTracingIntegrationShim); + expect(Bundle.linkedTracesIntegration).toBe(linkedTracesIntegrationShim); + expect(Bundle.browserTracingIntegration).toBe(browserTracingIntegrationShim); expect(Bundle.feedbackAsyncIntegration).toBe(feedbackIntegrationShim); expect(Bundle.feedbackIntegration).toBe(feedbackIntegrationShim); diff --git a/packages/browser/test/index.bundle.tracing.logs.metrics.test.ts b/packages/browser/test/index.bundle.tracing.logs.metrics.test.ts index 05f143f1f553..ff192380129f 100644 --- a/packages/browser/test/index.bundle.tracing.logs.metrics.test.ts +++ b/packages/browser/test/index.bundle.tracing.logs.metrics.test.ts @@ -1,11 +1,28 @@ import { logger as coreLogger, metrics as coreMetrics } from '@sentry/core'; import { feedbackIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims'; import { describe, expect, it } from 'vitest'; -import { browserTracingIntegration, spanStreamingIntegration, webVitalsIntegration } from '../src'; +import { + browserTracingCoreIntegration, + browserTracingIntegration, + fetchTracingIntegration, + linkedTracesIntegration, + longTasksIntegration, + resourcesIntegration, + spanStreamingIntegration, + webVitalsIntegration, + xhrTracingIntegration, +} from '../src'; import * as TracingLogsMetricsBundle from '../src/index.bundle.tracing.logs.metrics'; describe('index.bundle.tracing.logs.metrics', () => { it('has correct exports', () => { + expect(TracingLogsMetricsBundle.browserTracingCoreIntegration).toBe(browserTracingCoreIntegration); + expect(TracingLogsMetricsBundle.longTasksIntegration).toBe(longTasksIntegration); + expect(TracingLogsMetricsBundle.resourcesIntegration).toBe(resourcesIntegration); + expect(TracingLogsMetricsBundle.fetchTracingIntegration).toBe(fetchTracingIntegration); + expect(TracingLogsMetricsBundle.xhrTracingIntegration).toBe(xhrTracingIntegration); + expect(TracingLogsMetricsBundle.linkedTracesIntegration).toBe(linkedTracesIntegration); + expect(TracingLogsMetricsBundle.browserTracingIntegration).toBe(browserTracingIntegration); expect(TracingLogsMetricsBundle.feedbackAsyncIntegration).toBe(feedbackIntegrationShim); expect(TracingLogsMetricsBundle.feedbackIntegration).toBe(feedbackIntegrationShim); diff --git a/packages/browser/test/index.bundle.tracing.replay.feedback.logs.metrics.test.ts b/packages/browser/test/index.bundle.tracing.replay.feedback.logs.metrics.test.ts index a7b36563b1a3..18ae058fdeb5 100644 --- a/packages/browser/test/index.bundle.tracing.replay.feedback.logs.metrics.test.ts +++ b/packages/browser/test/index.bundle.tracing.replay.feedback.logs.metrics.test.ts @@ -1,16 +1,29 @@ import { logger as coreLogger, metrics as coreMetrics } from '@sentry/core'; import { describe, expect, it } from 'vitest'; import { + browserTracingCoreIntegration, browserTracingIntegration, feedbackAsyncIntegration, + fetchTracingIntegration, + linkedTracesIntegration, + longTasksIntegration, replayIntegration, + resourcesIntegration, spanStreamingIntegration, webVitalsIntegration, + xhrTracingIntegration, } from '../src'; import * as TracingReplayFeedbackLogsMetricsBundle from '../src/index.bundle.tracing.replay.feedback.logs.metrics'; describe('index.bundle.tracing.replay.feedback.logs.metrics', () => { it('has correct exports', () => { + expect(TracingReplayFeedbackLogsMetricsBundle.browserTracingCoreIntegration).toBe(browserTracingCoreIntegration); + expect(TracingReplayFeedbackLogsMetricsBundle.longTasksIntegration).toBe(longTasksIntegration); + expect(TracingReplayFeedbackLogsMetricsBundle.resourcesIntegration).toBe(resourcesIntegration); + expect(TracingReplayFeedbackLogsMetricsBundle.fetchTracingIntegration).toBe(fetchTracingIntegration); + expect(TracingReplayFeedbackLogsMetricsBundle.xhrTracingIntegration).toBe(xhrTracingIntegration); + expect(TracingReplayFeedbackLogsMetricsBundle.linkedTracesIntegration).toBe(linkedTracesIntegration); + expect(TracingReplayFeedbackLogsMetricsBundle.browserTracingIntegration).toBe(browserTracingIntegration); expect(TracingReplayFeedbackLogsMetricsBundle.feedbackAsyncIntegration).toBe(feedbackAsyncIntegration); expect(TracingReplayFeedbackLogsMetricsBundle.feedbackIntegration).toBe(feedbackAsyncIntegration); diff --git a/packages/browser/test/index.bundle.tracing.replay.feedback.test.ts b/packages/browser/test/index.bundle.tracing.replay.feedback.test.ts index 48186abdecc1..16f9230391b1 100644 --- a/packages/browser/test/index.bundle.tracing.replay.feedback.test.ts +++ b/packages/browser/test/index.bundle.tracing.replay.feedback.test.ts @@ -1,16 +1,29 @@ import { consoleLoggingIntegrationShim, loggerShim, metricsShim } from '@sentry-internal/integration-shims'; import { describe, expect, it } from 'vitest'; import { + browserTracingCoreIntegration, browserTracingIntegration, feedbackAsyncIntegration, + fetchTracingIntegration, + linkedTracesIntegration, + longTasksIntegration, replayIntegration, + resourcesIntegration, spanStreamingIntegration, webVitalsIntegration, + xhrTracingIntegration, } from '../src'; import * as TracingReplayFeedbackBundle from '../src/index.bundle.tracing.replay.feedback'; describe('index.bundle.tracing.replay.feedback', () => { it('has correct exports', () => { + expect(TracingReplayFeedbackBundle.browserTracingCoreIntegration).toBe(browserTracingCoreIntegration); + expect(TracingReplayFeedbackBundle.longTasksIntegration).toBe(longTasksIntegration); + expect(TracingReplayFeedbackBundle.resourcesIntegration).toBe(resourcesIntegration); + expect(TracingReplayFeedbackBundle.fetchTracingIntegration).toBe(fetchTracingIntegration); + expect(TracingReplayFeedbackBundle.xhrTracingIntegration).toBe(xhrTracingIntegration); + expect(TracingReplayFeedbackBundle.linkedTracesIntegration).toBe(linkedTracesIntegration); + expect(TracingReplayFeedbackBundle.browserTracingIntegration).toBe(browserTracingIntegration); expect(TracingReplayFeedbackBundle.feedbackAsyncIntegration).toBe(feedbackAsyncIntegration); expect(TracingReplayFeedbackBundle.feedbackIntegration).toBe(feedbackAsyncIntegration); diff --git a/packages/browser/test/index.bundle.tracing.replay.logs.metrics.test.ts b/packages/browser/test/index.bundle.tracing.replay.logs.metrics.test.ts index 610534f5602f..62ceaa2894a7 100644 --- a/packages/browser/test/index.bundle.tracing.replay.logs.metrics.test.ts +++ b/packages/browser/test/index.bundle.tracing.replay.logs.metrics.test.ts @@ -1,11 +1,29 @@ import { logger as coreLogger, metrics as coreMetrics } from '@sentry/core'; import { feedbackIntegrationShim } from '@sentry-internal/integration-shims'; import { describe, expect, it } from 'vitest'; -import { browserTracingIntegration, replayIntegration, spanStreamingIntegration, webVitalsIntegration } from '../src'; +import { + browserTracingCoreIntegration, + browserTracingIntegration, + fetchTracingIntegration, + linkedTracesIntegration, + longTasksIntegration, + replayIntegration, + resourcesIntegration, + spanStreamingIntegration, + webVitalsIntegration, + xhrTracingIntegration, +} from '../src'; import * as TracingReplayLogsMetricsBundle from '../src/index.bundle.tracing.replay.logs.metrics'; describe('index.bundle.tracing.replay.logs.metrics', () => { it('has correct exports', () => { + expect(TracingReplayLogsMetricsBundle.browserTracingCoreIntegration).toBe(browserTracingCoreIntegration); + expect(TracingReplayLogsMetricsBundle.longTasksIntegration).toBe(longTasksIntegration); + expect(TracingReplayLogsMetricsBundle.resourcesIntegration).toBe(resourcesIntegration); + expect(TracingReplayLogsMetricsBundle.fetchTracingIntegration).toBe(fetchTracingIntegration); + expect(TracingReplayLogsMetricsBundle.xhrTracingIntegration).toBe(xhrTracingIntegration); + expect(TracingReplayLogsMetricsBundle.linkedTracesIntegration).toBe(linkedTracesIntegration); + expect(TracingReplayLogsMetricsBundle.browserTracingIntegration).toBe(browserTracingIntegration); expect(TracingReplayLogsMetricsBundle.feedbackAsyncIntegration).toBe(feedbackIntegrationShim); expect(TracingReplayLogsMetricsBundle.feedbackIntegration).toBe(feedbackIntegrationShim); diff --git a/packages/browser/test/index.bundle.tracing.replay.test.ts b/packages/browser/test/index.bundle.tracing.replay.test.ts index 20c5162e902b..5568657db3fe 100644 --- a/packages/browser/test/index.bundle.tracing.replay.test.ts +++ b/packages/browser/test/index.bundle.tracing.replay.test.ts @@ -5,11 +5,29 @@ import { metricsShim, } from '@sentry-internal/integration-shims'; import { describe, expect, it } from 'vitest'; -import { browserTracingIntegration, replayIntegration, spanStreamingIntegration, webVitalsIntegration } from '../src'; +import { + browserTracingCoreIntegration, + browserTracingIntegration, + fetchTracingIntegration, + linkedTracesIntegration, + longTasksIntegration, + replayIntegration, + resourcesIntegration, + spanStreamingIntegration, + webVitalsIntegration, + xhrTracingIntegration, +} from '../src'; import * as TracingReplayBundle from '../src/index.bundle.tracing.replay'; describe('index.bundle.tracing.replay', () => { it('has correct exports', () => { + expect(TracingReplayBundle.browserTracingCoreIntegration).toBe(browserTracingCoreIntegration); + expect(TracingReplayBundle.longTasksIntegration).toBe(longTasksIntegration); + expect(TracingReplayBundle.resourcesIntegration).toBe(resourcesIntegration); + expect(TracingReplayBundle.fetchTracingIntegration).toBe(fetchTracingIntegration); + expect(TracingReplayBundle.xhrTracingIntegration).toBe(xhrTracingIntegration); + expect(TracingReplayBundle.linkedTracesIntegration).toBe(linkedTracesIntegration); + expect(TracingReplayBundle.browserTracingIntegration).toBe(browserTracingIntegration); expect(TracingReplayBundle.feedbackAsyncIntegration).toBe(feedbackIntegrationShim); expect(TracingReplayBundle.feedbackIntegration).toBe(feedbackIntegrationShim); diff --git a/packages/browser/test/index.bundle.tracing.test.ts b/packages/browser/test/index.bundle.tracing.test.ts index bc7d0abab086..95cd1b7fa48e 100644 --- a/packages/browser/test/index.bundle.tracing.test.ts +++ b/packages/browser/test/index.bundle.tracing.test.ts @@ -6,11 +6,28 @@ import { replayIntegrationShim, } from '@sentry-internal/integration-shims'; import { describe, expect, it } from 'vitest'; -import { browserTracingIntegration, spanStreamingIntegration, webVitalsIntegration } from '../src'; +import { + browserTracingCoreIntegration, + browserTracingIntegration, + fetchTracingIntegration, + linkedTracesIntegration, + longTasksIntegration, + resourcesIntegration, + spanStreamingIntegration, + webVitalsIntegration, + xhrTracingIntegration, +} from '../src'; import * as TracingBundle from '../src/index.bundle.tracing'; describe('index.bundle.tracing', () => { it('has correct exports', () => { + expect(TracingBundle.browserTracingCoreIntegration).toBe(browserTracingCoreIntegration); + expect(TracingBundle.longTasksIntegration).toBe(longTasksIntegration); + expect(TracingBundle.resourcesIntegration).toBe(resourcesIntegration); + expect(TracingBundle.fetchTracingIntegration).toBe(fetchTracingIntegration); + expect(TracingBundle.xhrTracingIntegration).toBe(xhrTracingIntegration); + expect(TracingBundle.linkedTracesIntegration).toBe(linkedTracesIntegration); + expect(TracingBundle.browserTracingIntegration).toBe(browserTracingIntegration); expect(TracingBundle.feedbackAsyncIntegration).toBe(feedbackIntegrationShim); expect(TracingBundle.feedbackIntegration).toBe(feedbackIntegrationShim); diff --git a/packages/integration-shims/src/TracingIntegrations.ts b/packages/integration-shims/src/TracingIntegrations.ts new file mode 100644 index 000000000000..d8f90bbca03c --- /dev/null +++ b/packages/integration-shims/src/TracingIntegrations.ts @@ -0,0 +1,52 @@ +import { consoleSandbox, defineIntegration } from '@sentry/core'; + +/** + * Creates a shim for one of the integrations that make up `browserTracingIntegration`. + * It is needed in order for the CDN bundles to continue working when users add/remove tracing + * from it, without changing their config. This is necessary for the loader mechanism. + */ +function makeTracingIntegrationShim(name: string, functionName: string): ReturnType { + return defineIntegration((_options?: unknown) => { + consoleSandbox(() => { + // eslint-disable-next-line no-console + console.warn(`You are using ${functionName}() even though this bundle does not include tracing.`); + }); + + return { + name, + }; + }); +} + +/** + * This is a shim for the `browserTracingCoreIntegration`. + */ +export const browserTracingCoreIntegrationShim = makeTracingIntegrationShim( + 'BrowserTracing', + 'browserTracingCoreIntegration', +); + +/** + * This is a shim for the `longTasksIntegration`. + */ +export const longTasksIntegrationShim = makeTracingIntegrationShim('LongTasks', 'longTasksIntegration'); + +/** + * This is a shim for the `resourcesIntegration`. + */ +export const resourcesIntegrationShim = makeTracingIntegrationShim('Resources', 'resourcesIntegration'); + +/** + * This is a shim for the `fetchTracingIntegration`. + */ +export const fetchTracingIntegrationShim = makeTracingIntegrationShim('FetchTracing', 'fetchTracingIntegration'); + +/** + * This is a shim for the `xhrTracingIntegration`. + */ +export const xhrTracingIntegrationShim = makeTracingIntegrationShim('XhrTracing', 'xhrTracingIntegration'); + +/** + * This is a shim for the `linkedTracesIntegration`. + */ +export const linkedTracesIntegrationShim = makeTracingIntegrationShim('LinkedTraces', 'linkedTracesIntegration'); diff --git a/packages/integration-shims/src/index.ts b/packages/integration-shims/src/index.ts index 051bda210c4f..aafb04cc82a3 100644 --- a/packages/integration-shims/src/index.ts +++ b/packages/integration-shims/src/index.ts @@ -7,3 +7,11 @@ export { loggerShim, consoleLoggingIntegrationShim } from './logs'; export { metricsShim } from './metrics'; export { spanStreamingIntegrationShim } from './SpanStreaming'; export { fetchStreamPerformanceIntegrationShim } from './FetchStreamPerformance'; +export { + browserTracingCoreIntegrationShim, + longTasksIntegrationShim, + resourcesIntegrationShim, + fetchTracingIntegrationShim, + xhrTracingIntegrationShim, + linkedTracesIntegrationShim, +} from './TracingIntegrations';