Skip to content

feat(fedback): Convert CDN bundles to use async feedback for lower bundle sizes #11791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
import { lazyLoadIntegration } from './utils/lazyLoadIntegration';

/** Add a widget to capture user feedback to your application. */
export const feedbackIntegration = buildFeedbackIntegration({
export const feedbackSyncIntegration = buildFeedbackIntegration({
lazyLoadIntegration,
getModalIntegration: () => feedbackModalIntegration,
getScreenshotIntegration: () => feedbackScreenshotIntegration,
Expand Down
9 changes: 7 additions & 2 deletions packages/browser/src/index.bundle.feedback.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { browserTracingIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims';
import { feedbackAsyncIntegration } from './feedbackAsync';

export * from './index.bundle.base';

export { feedbackIntegration } from './feedback';
export { getFeedback } from '@sentry-internal/feedback';

export { browserTracingIntegrationShim as browserTracingIntegration, replayIntegrationShim as replayIntegration };
export {
browserTracingIntegrationShim as browserTracingIntegration,
feedbackAsyncIntegration as feedbackAsyncIntegration,
feedbackAsyncIntegration as feedbackIntegration,
replayIntegrationShim as replayIntegration,
};
6 changes: 5 additions & 1 deletion packages/browser/src/index.bundle.replay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ export * from './index.bundle.base';

export { replayIntegration } from '@sentry-internal/replay';

export { browserTracingIntegrationShim as browserTracingIntegration, feedbackIntegrationShim as feedbackIntegration };
export {
browserTracingIntegrationShim as browserTracingIntegration,
feedbackIntegrationShim as feedbackAsyncIntegration,
feedbackIntegrationShim as feedbackIntegration,
};
7 changes: 4 additions & 3 deletions packages/browser/src/index.bundle.tracing.replay.feedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ export {
setMeasurement,
} from '@sentry/core';

export { feedbackIntegration } from './feedback';
export { getFeedback } from '@sentry-internal/feedback';

export {
browserTracingIntegration,
startBrowserTracingNavigationSpan,
startBrowserTracingPageLoadSpan,
} from './tracing/browserTracingIntegration';

import { feedbackAsyncIntegration } from './feedbackAsync';
export { getFeedback } from '@sentry-internal/feedback';
export { feedbackAsyncIntegration as feedbackAsyncIntegration, feedbackAsyncIntegration as feedbackIntegration };

export { replayIntegration } from '@sentry-internal/replay';
4 changes: 2 additions & 2 deletions packages/browser/src/index.bundle.tracing.replay.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { feedbackIntegrationShim } from '@sentry-internal/integration-shims';
import { registerSpanErrorInstrumentation } from '@sentry/core';

registerSpanErrorInstrumentation();
Expand All @@ -22,6 +21,7 @@ export {
startBrowserTracingPageLoadSpan,
} from './tracing/browserTracingIntegration';

export { feedbackIntegrationShim as feedbackIntegration };
import { feedbackIntegrationShim } from '@sentry-internal/integration-shims';
export { feedbackIntegrationShim as feedbackAsyncIntegration, feedbackIntegrationShim as feedbackIntegration };

export { replayIntegration } from '@sentry-internal/replay';
6 changes: 5 additions & 1 deletion packages/browser/src/index.bundle.tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@ export {
startBrowserTracingPageLoadSpan,
} from './tracing/browserTracingIntegration';

export { feedbackIntegrationShim as feedbackIntegration, replayIntegrationShim as replayIntegration };
export {
feedbackIntegrationShim as feedbackAsyncIntegration,
feedbackIntegrationShim as feedbackIntegration,
replayIntegrationShim as replayIntegration,
};
1 change: 1 addition & 0 deletions packages/browser/src/index.bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export * from './index.bundle.base';

export {
browserTracingIntegrationShim as browserTracingIntegration,
feedbackIntegrationShim as feedbackAsyncIntegration,
feedbackIntegrationShim as feedbackIntegration,
replayIntegrationShim as replayIntegration,
};
5 changes: 3 additions & 2 deletions packages/browser/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ export type {

export { replayCanvasIntegration } from '@sentry-internal/replay-canvas';

export { feedbackIntegration } from './feedback';
export { feedbackAsyncIntegration } from './feedbackAsync';
import { feedbackAsyncIntegration } from './feedbackAsync';
import { feedbackSyncIntegration } from './feedbackSync';
export { feedbackAsyncIntegration, feedbackSyncIntegration, feedbackSyncIntegration as feedbackIntegration };
export {
getFeedback,
sendFeedback,
Expand Down
5 changes: 3 additions & 2 deletions packages/browser/test/unit/index.bundle.feedback.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { browserTracingIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims';
import { feedbackIntegration } from '../../src';
import { feedbackAsyncIntegration } from '../../src';

import * as FeedbackBundle from '../../src/index.bundle.feedback';

describe('index.bundle.feedback', () => {
it('has correct exports', () => {
expect(FeedbackBundle.browserTracingIntegration).toBe(browserTracingIntegrationShim);
expect(FeedbackBundle.feedbackAsyncIntegration).toBe(feedbackAsyncIntegration);
expect(FeedbackBundle.feedbackIntegration).toBe(feedbackAsyncIntegration);
expect(FeedbackBundle.replayIntegration).toBe(replayIntegrationShim);
expect(FeedbackBundle.feedbackIntegration).toBe(feedbackIntegration);
});
});
8 changes: 5 additions & 3 deletions packages/browser/test/unit/index.bundle.replay.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { feedbackIntegrationShim } from '@sentry-internal/integration-shims';
import { replayIntegration } from '@sentry/browser';
import { browserTracingIntegrationShim, feedbackIntegrationShim } from '@sentry-internal/integration-shims';
import { replayIntegration } from '../../src';

import * as ReplayBundle from '../../src/index.bundle.replay';

describe('index.bundle.replay', () => {
it('has correct exports', () => {
expect(ReplayBundle.replayIntegration).toBe(replayIntegration);
expect(ReplayBundle.browserTracingIntegration).toBe(browserTracingIntegrationShim);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of the test files were missing various assertions (none of them assert that getFeedback or the long list of tracing helpers exist)

I made sure they all assert that browserTracingIntegration is set, and the order of assertions is consistent to hopefully make it easier going forward to verify what's here and add new ones.

expect(ReplayBundle.feedbackAsyncIntegration).toBe(feedbackIntegrationShim);
expect(ReplayBundle.feedbackIntegration).toBe(feedbackIntegrationShim);
expect(ReplayBundle.replayIntegration).toBe(replayIntegration);
});
});
10 changes: 8 additions & 2 deletions packages/browser/test/unit/index.bundle.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { feedbackIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims';
import {
browserTracingIntegrationShim,
feedbackIntegrationShim,
replayIntegrationShim,
} from '@sentry-internal/integration-shims';

import * as Bundle from '../../src/index.bundle';

describe('index.bundle', () => {
it('has correct exports', () => {
expect(Bundle.replayIntegration).toBe(replayIntegrationShim);
expect(Bundle.browserTracingIntegration).toBe(browserTracingIntegrationShim);
expect(Bundle.feedbackAsyncIntegration).toBe(feedbackIntegrationShim);
expect(Bundle.feedbackIntegration).toBe(feedbackIntegrationShim);
expect(Bundle.replayIntegration).toBe(replayIntegrationShim);
});
});
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { browserTracingIntegration, feedbackIntegration, replayIntegration } from '../../src';
import { browserTracingIntegration, feedbackAsyncIntegration, replayIntegration } from '../../src';

import * as TracingReplayFeedbackBundle from '../../src/index.bundle.tracing.replay.feedback';

describe('index.bundle.tracing.replay.feedback', () => {
it('has correct exports', () => {
expect(TracingReplayFeedbackBundle.replayIntegration).toBe(replayIntegration);
expect(TracingReplayFeedbackBundle.browserTracingIntegration).toBe(browserTracingIntegration);
expect(TracingReplayFeedbackBundle.feedbackIntegration).toBe(feedbackIntegration);
expect(TracingReplayFeedbackBundle.feedbackAsyncIntegration).toBe(feedbackAsyncIntegration);
expect(TracingReplayFeedbackBundle.feedbackIntegration).toBe(feedbackAsyncIntegration);
expect(TracingReplayFeedbackBundle.replayIntegration).toBe(replayIntegration);
});
});
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { feedbackIntegrationShim } from '@sentry-internal/integration-shims';

import { browserTracingIntegration, replayIntegration } from '../../src';

import * as TracingReplayBundle from '../../src/index.bundle.tracing.replay';

describe('index.bundle.tracing.replay', () => {
it('has correct exports', () => {
expect(TracingReplayBundle.replayIntegration).toBe(replayIntegration);

expect(TracingReplayBundle.browserTracingIntegration).toBe(browserTracingIntegration);

expect(TracingReplayBundle.feedbackAsyncIntegration).toBe(feedbackIntegrationShim);
expect(TracingReplayBundle.feedbackIntegration).toBe(feedbackIntegrationShim);
expect(TracingReplayBundle.replayIntegration).toBe(replayIntegration);
});
});
5 changes: 3 additions & 2 deletions packages/browser/test/unit/index.bundle.tracing.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { feedbackIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims';

import { browserTracingIntegration } from '../../src';

import * as TracingBundle from '../../src/index.bundle.tracing';

describe('index.bundle.tracing', () => {
it('has correct exports', () => {
expect(TracingBundle.replayIntegration).toBe(replayIntegrationShim);
expect(TracingBundle.browserTracingIntegration).toBe(browserTracingIntegration);
expect(TracingBundle.feedbackAsyncIntegration).toBe(feedbackIntegrationShim);
expect(TracingBundle.feedbackIntegration).toBe(feedbackIntegrationShim);
expect(TracingBundle.replayIntegration).toBe(replayIntegrationShim);
});
});