Skip to content

Commit 125c6db

Browse files
authored
Merge branch 'develop' into sig/console-aws-lambda-fix
2 parents ef9eaa6 + 2fd74e9 commit 125c6db

50 files changed

Lines changed: 1375 additions & 516 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.size-limit.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ module.exports = [
203203
name: 'CDN Bundle (incl. Tracing, Logs, Metrics)',
204204
path: createCDNPath('bundle.tracing.logs.metrics.min.js'),
205205
gzip: true,
206-
limit: '46 KB',
206+
limit: '47 KB',
207207
},
208208
{
209209
name: 'CDN Bundle (incl. Replay, Logs, Metrics)',
@@ -221,7 +221,7 @@ module.exports = [
221221
name: 'CDN Bundle (incl. Tracing, Replay, Logs, Metrics)',
222222
path: createCDNPath('bundle.tracing.replay.logs.metrics.min.js'),
223223
gzip: true,
224-
limit: '83 KB',
224+
limit: '84 KB',
225225
},
226226
{
227227
name: 'CDN Bundle (incl. Tracing, Replay, Feedback)',
@@ -283,7 +283,7 @@ module.exports = [
283283
path: createCDNPath('bundle.tracing.replay.logs.metrics.min.js'),
284284
gzip: false,
285285
brotli: false,
286-
limit: '255 KB',
286+
limit: '256 KB',
287287
},
288288
{
289289
name: 'CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed',
@@ -297,7 +297,7 @@ module.exports = [
297297
path: createCDNPath('bundle.tracing.replay.feedback.logs.metrics.min.js'),
298298
gzip: false,
299299
brotli: false,
300-
limit: '268 KB',
300+
limit: '269 KB',
301301
},
302302
// Next.js SDK (ESM)
303303
{
@@ -324,7 +324,7 @@ module.exports = [
324324
import: createImport('init'),
325325
ignore: [...builtinModules, ...nodePrefixedBuiltinModules],
326326
gzip: true,
327-
limit: '59 KB',
327+
limit: '60 KB',
328328
},
329329
// Node SDK (ESM)
330330
{
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import * as Sentry from '@sentry/browser';
2+
3+
window.Sentry = Sentry;
4+
5+
Sentry.init({
6+
dsn: 'https://public@dsn.ingest.sentry.io/1337',
7+
integrations: [
8+
Sentry.browserTracingIntegration({ instrumentPageLoad: false, instrumentNavigation: false }),
9+
Sentry.spanStreamingIntegration(),
10+
],
11+
tracesSampleRate: 1,
12+
sendClientReports: true,
13+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fetch('http://sentry-test-site.example/api/test');
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { expect } from '@playwright/test';
2+
import type { ClientReport } from '@sentry/core';
3+
import { sentryTest } from '../../../utils/fixtures';
4+
import {
5+
envelopeRequestParser,
6+
hidePage,
7+
shouldSkipTracingTest,
8+
testingCdnBundle,
9+
waitForClientReportRequest,
10+
} from '../../../utils/helpers';
11+
12+
sentryTest(
13+
'records no_parent_span client report for fetch requests without an active span',
14+
async ({ getLocalTestUrl, page }) => {
15+
sentryTest.skip(shouldSkipTracingTest() || testingCdnBundle());
16+
17+
await page.route('http://sentry-test-site.example/api/test', route => {
18+
route.fulfill({
19+
status: 200,
20+
body: 'ok',
21+
headers: { 'Content-Type': 'text/plain' },
22+
});
23+
});
24+
25+
const url = await getLocalTestUrl({ testDir: __dirname });
26+
27+
const clientReportPromise = waitForClientReportRequest(page, report => {
28+
return report.discarded_events.some(e => e.reason === 'no_parent_span');
29+
});
30+
31+
await page.goto(url);
32+
33+
await hidePage(page);
34+
35+
const clientReport = envelopeRequestParser<ClientReport>(await clientReportPromise);
36+
37+
expect(clientReport.discarded_events).toEqual([
38+
{
39+
category: 'span',
40+
quantity: 1,
41+
reason: 'no_parent_span',
42+
},
43+
]);
44+
},
45+
);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import * as Sentry from '@sentry/browser';
2+
3+
window.Sentry = Sentry;
4+
5+
Sentry.init({
6+
dsn: 'https://public@dsn.ingest.sentry.io/1337',
7+
integrations: [Sentry.browserTracingIntegration({ instrumentPageLoad: false, instrumentNavigation: false })],
8+
tracesSampleRate: 1,
9+
sendClientReports: true,
10+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fetch('http://sentry-test-site.example/api/test');
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { expect } from '@playwright/test';
2+
import type { ClientReport } from '@sentry/core';
3+
import { sentryTest } from '../../../utils/fixtures';
4+
import {
5+
envelopeRequestParser,
6+
hidePage,
7+
shouldSkipTracingTest,
8+
testingCdnBundle,
9+
waitForClientReportRequest,
10+
} from '../../../utils/helpers';
11+
12+
sentryTest(
13+
'records no_parent_span client report for fetch requests without an active span',
14+
async ({ getLocalTestUrl, page }) => {
15+
sentryTest.skip(shouldSkipTracingTest() || testingCdnBundle());
16+
17+
await page.route('http://sentry-test-site.example/api/test', route => {
18+
route.fulfill({
19+
status: 200,
20+
body: 'ok',
21+
headers: { 'Content-Type': 'text/plain' },
22+
});
23+
});
24+
25+
const url = await getLocalTestUrl({ testDir: __dirname });
26+
27+
const clientReportPromise = waitForClientReportRequest(page, report => {
28+
return report.discarded_events.some(e => e.reason === 'no_parent_span');
29+
});
30+
31+
await page.goto(url);
32+
33+
await hidePage(page);
34+
35+
const clientReport = envelopeRequestParser<ClientReport>(await clientReportPromise);
36+
37+
expect(clientReport.discarded_events).toEqual([
38+
{
39+
category: 'span',
40+
quantity: 1,
41+
reason: 'no_parent_span',
42+
},
43+
]);
44+
},
45+
);

dev-packages/bun-integration-tests/expect.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ export function expectedEvent(event: Event, { sdk }: { sdk: 'bun' | 'hono' }): E
6868

6969
export function eventEnvelope(
7070
event: Event,
71-
{ includeSampleRand = false, sdk = 'bun' }: { includeSampleRand?: boolean; sdk?: 'bun' | 'hono' } = {},
71+
{
72+
includeSampleRand = false,
73+
includeTransaction = true,
74+
sdk = 'bun',
75+
}: { includeSampleRand?: boolean; includeTransaction?: boolean; sdk?: 'bun' | 'hono' } = {},
7276
): Envelope {
7377
return [
7478
{
@@ -79,11 +83,13 @@ export function eventEnvelope(
7983
environment: event.environment || 'production',
8084
public_key: 'public',
8185
trace_id: UUID_MATCHER,
86+
8287
sample_rate: expect.any(String),
8388
sampled: expect.any(String),
8489
// release is auto-detected from GitHub CI env vars, so only expect it if we know it will be there
8590
...(process.env.GITHUB_SHA ? { release: expect.any(String) } : {}),
8691
...(includeSampleRand && { sample_rand: expect.stringMatching(/^[01](\.\d+)?$/) }),
92+
...(includeTransaction && { transaction: expect.any(String) }),
8793
},
8894
},
8995
[[{ type: 'event' }, expectedEvent(event, { sdk })]],

dev-packages/bun-integration-tests/suites/basic/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ it('captures an error thrown in Bun.serve fetch handler', async ({ signal }) =>
2525
url: expect.stringContaining('/error'),
2626
}),
2727
},
28-
{ includeSampleRand: true },
28+
{ includeSampleRand: true, includeTransaction: false },
2929
),
3030
)
3131
.ignore('transaction')
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { sentry } from '@sentry/hono/bun';
2+
import { Hono } from 'hono';
3+
4+
const app = new Hono();
5+
6+
app.use(
7+
sentry(app, {
8+
dsn: process.env.SENTRY_DSN,
9+
tracesSampleRate: 1.0,
10+
}),
11+
);
12+
13+
app.get('/', c => {
14+
return c.text('Hello from Hono on Bun!');
15+
});
16+
17+
app.get('/hello/:name', c => {
18+
const name = c.req.param('name');
19+
return c.text(`Hello, ${name}!`);
20+
});
21+
22+
app.get('/error/:param', () => {
23+
throw new Error('Test error from Hono app');
24+
});
25+
26+
const server = Bun.serve({
27+
port: 0,
28+
fetch: app.fetch,
29+
});
30+
31+
process.send?.(JSON.stringify({ event: 'READY', port: server.port }));

0 commit comments

Comments
 (0)