Skip to content

Commit 419a0e6

Browse files
authored
feat(browser): Add CDN bundle for tracing.logs.metrics (#18784)
closes #18782 ref #16314 Note that metrics were bundled into the base config and will be moved into this bundle starting with v11 (ref #18583)
1 parent ad3dd01 commit 419a0e6

File tree

14 files changed

+128
-16
lines changed

14 files changed

+128
-16
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ jobs:
568568
- bundle_min
569569
- bundle_replay
570570
- bundle_tracing
571+
- bundle_tracing_logs_metrics
571572
- bundle_tracing_replay
572573
- bundle_tracing_replay_feedback
573574
- bundle_tracing_replay_feedback_min

.size-limit.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ module.exports = [
186186
gzip: true,
187187
limit: '43 KB',
188188
},
189+
{
190+
name: 'CDN Bundle (incl. Tracing, Logs, Metrics)',
191+
path: createCDNPath('bundle.tracing.logs.metrics.min.js'),
192+
gzip: true,
193+
limit: '44 KB',
194+
},
189195
{
190196
name: 'CDN Bundle (incl. Tracing, Replay)',
191197
path: createCDNPath('bundle.tracing.replay.min.js'),
@@ -213,6 +219,13 @@ module.exports = [
213219
brotli: false,
214220
limit: '127 KB',
215221
},
222+
{
223+
name: 'CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed',
224+
path: createCDNPath('bundle.tracing.logs.metrics.min.js'),
225+
gzip: false,
226+
brotli: false,
227+
limit: '130 KB',
228+
},
216229
{
217230
name: 'CDN Bundle (incl. Tracing, Replay) - uncompressed',
218231
path: createCDNPath('bundle.tracing.replay.min.js'),

dev-packages/browser-integration-tests/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ To filter tests by their title:
7474

7575
You can refer to [Playwright documentation](https://playwright.dev/docs/test-cli) for other CLI options.
7676

77-
You can set env variable `PW_BUNDLE` to set specific build or bundle to test against. Available options: `esm`, `cjs`,
78-
`bundle`, `bundle_min`
77+
You can set env variable `PW_BUNDLE` to set specific build or bundle to test against. Available options include: `esm`, `cjs`,
78+
`bundle`, `bundle_min`, `bundle_tracing`, `bundle_tracing_logs_metrics`, `bundle_replay`, `bundle_tracing_replay_feedback`, and more.
79+
See `package.json` scripts for the full list of `test:bundle:*` commands.
7980

8081
### Troubleshooting
8182

dev-packages/browser-integration-tests/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
"test:bundle:replay:min": "PW_BUNDLE=bundle_replay_min yarn test",
2424
"test:bundle:tracing": "PW_BUNDLE=bundle_tracing yarn test",
2525
"test:bundle:tracing:min": "PW_BUNDLE=bundle_tracing_min yarn test",
26+
"test:bundle:tracing_logs_metrics": "PW_BUNDLE=bundle_tracing_logs_metrics yarn test",
27+
"test:bundle:tracing_logs_metrics:min": "PW_BUNDLE=bundle_tracing_logs_metrics_min yarn test",
28+
"test:bundle:tracing_logs_metrics:debug_min": "PW_BUNDLE=bundle_tracing_logs_metrics_debug_min yarn test",
2629
"test:bundle:full": "PW_BUNDLE=bundle_tracing_replay_feedback yarn test",
2730
"test:bundle:full:min": "PW_BUNDLE=bundle_tracing_replay_feedback_min yarn test",
2831
"test:cjs": "PW_BUNDLE=cjs yarn test",

dev-packages/browser-integration-tests/suites/public-api/logger/integration/test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import { sentryTest } from '../../../../utils/fixtures';
44
import {
55
getFirstSentryEnvelopeRequest,
66
properFullEnvelopeRequestParser,
7-
testingCdnBundle,
7+
shouldSkipLogsTest,
88
} from '../../../../utils/helpers';
99

1010
sentryTest('should capture console object calls', async ({ getLocalTestUrl, page }) => {
11-
// Only run this for npm package exports
12-
sentryTest.skip(testingCdnBundle());
11+
// Only run this for npm package exports and CDN bundles with logs
12+
sentryTest.skip(shouldSkipLogsTest());
1313

1414
const url = await getLocalTestUrl({ testDir: __dirname });
1515

dev-packages/browser-integration-tests/suites/public-api/logger/scopeAttributes/test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import { sentryTest } from '../../../../utils/fixtures';
44
import {
55
getFirstSentryEnvelopeRequest,
66
properFullEnvelopeRequestParser,
7-
testingCdnBundle,
7+
shouldSkipLogsTest,
88
} from '../../../../utils/helpers';
99

1010
sentryTest('captures logs with scope attributes', async ({ getLocalTestUrl, page }) => {
11-
sentryTest.skip(testingCdnBundle());
11+
sentryTest.skip(shouldSkipLogsTest());
1212

1313
const url = await getLocalTestUrl({ testDir: __dirname });
1414

dev-packages/browser-integration-tests/suites/public-api/logger/simple/test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import { sentryTest } from '../../../../utils/fixtures';
44
import {
55
getFirstSentryEnvelopeRequest,
66
properFullEnvelopeRequestParser,
7-
testingCdnBundle,
7+
shouldSkipLogsTest,
88
} from '../../../../utils/helpers';
99

1010
sentryTest('should capture all logging methods', async ({ getLocalTestUrl, page }) => {
11-
// Only run this for npm package exports
12-
sentryTest.skip(testingCdnBundle());
11+
// Only run this for npm package exports and CDN bundles with logs
12+
sentryTest.skip(shouldSkipLogsTest());
1313

1414
const url = await getLocalTestUrl({ testDir: __dirname });
1515

dev-packages/browser-integration-tests/suites/public-api/metrics/afterCaptureMetric/test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { expect } from '@playwright/test';
22
import { sentryTest } from '../../../../utils/fixtures';
3+
import { shouldSkipMetricsTest } from '../../../../utils/helpers';
34

45
sentryTest(
56
'should emit afterCaptureMetric event with processed metric from beforeSendMetric',
67
async ({ getLocalTestUrl, page }) => {
7-
const bundle = process.env.PW_BUNDLE || '';
8-
if (bundle.startsWith('bundle') || bundle.startsWith('loader')) {
8+
// Only run this for npm package exports and CDN bundles with metrics
9+
if (shouldSkipMetricsTest()) {
910
sentryTest.skip();
1011
}
1112

dev-packages/browser-integration-tests/suites/public-api/metrics/simple/test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import { expect } from '@playwright/test';
22
import type { MetricEnvelope } from '@sentry/core';
33
import { sentryTest } from '../../../../utils/fixtures';
4-
import { getFirstSentryEnvelopeRequest, properFullEnvelopeRequestParser } from '../../../../utils/helpers';
4+
import {
5+
getFirstSentryEnvelopeRequest,
6+
properFullEnvelopeRequestParser,
7+
shouldSkipMetricsTest,
8+
} from '../../../../utils/helpers';
59

610
sentryTest('should capture all metric types', async ({ getLocalTestUrl, page }) => {
7-
const bundle = process.env.PW_BUNDLE || '';
8-
if (bundle.startsWith('bundle') || bundle.startsWith('loader')) {
11+
// Only run this for npm package exports and CDN bundles with metrics
12+
if (shouldSkipMetricsTest()) {
913
sentryTest.skip();
1014
}
1115

dev-packages/browser-integration-tests/utils/generatePlugin.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ const BUNDLE_PATHS: Record<string, Record<string, string>> = {
5656
bundle_replay_min: 'build/bundles/bundle.replay.min.js',
5757
bundle_tracing: 'build/bundles/bundle.tracing.js',
5858
bundle_tracing_min: 'build/bundles/bundle.tracing.min.js',
59+
bundle_tracing_logs_metrics: 'build/bundles/bundle.tracing.logs.metrics.js',
60+
bundle_tracing_logs_metrics_min: 'build/bundles/bundle.tracing.logs.metrics.min.js',
61+
bundle_tracing_logs_metrics_debug_min: 'build/bundles/bundle.tracing.logs.metrics.debug.min.js',
5962
bundle_tracing_replay: 'build/bundles/bundle.tracing.replay.js',
6063
bundle_tracing_replay_min: 'build/bundles/bundle.tracing.replay.min.js',
6164
bundle_tracing_replay_feedback: 'build/bundles/bundle.tracing.replay.feedback.js',
@@ -245,7 +248,9 @@ class SentryScenarioGenerationPlugin {
245248
.replace('loader_', 'bundle_')
246249
.replace('_replay', '')
247250
.replace('_tracing', '')
248-
.replace('_feedback', '');
251+
.replace('_feedback', '')
252+
.replace('_logs', '')
253+
.replace('_metrics', '');
249254

250255
// For feedback bundle, make sure to add modal & screenshot integrations
251256
if (bundleKey.includes('_feedback')) {

0 commit comments

Comments
 (0)