Skip to content

Commit

Permalink
chore: merge branch 'develop' into bo-amqplib
Browse files Browse the repository at this point in the history
  • Loading branch information
obecny committed Sep 20, 2024
2 parents 4bc9f41 + 216aaeb commit 366cb67
Show file tree
Hide file tree
Showing 47 changed files with 842 additions and 275 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,7 @@ jobs:
strategy:
fail-fast: false
matrix:
# TODO(lforst): Unpin Node.js version 22 when https://github.com/protobufjs/protobuf.js/issues/2025 is resolved which broke the nodejs tests
node: [14, 16, 18, 20, '22.6.0']
node: [14, 16, 18, 20, 22]
steps:
- name: Check out base commit (${{ github.event.pull_request.base.sha }})
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

- "You miss 100 percent of the chances you don't take. — Wayne Gretzky" — Michael Scott

Work in this release was contributed by @KyGuy2002 and @artzhookov. Thank you for your contributions!
Work in this release was contributed by @KyGuy2002, @artzhookov, and @julianCast. Thank you for your contributions!

## 8.30.0

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Link from 'next/link';

export const dynamic = 'force-dynamic';

export default function Page() {
return <Link href="/navigation">Go back home</Link>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Link from 'next/link';

export const dynamic = 'force-dynamic';

export default function Page() {
return <Link href="/navigation">Go back home</Link>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Link from 'next/link';

export const dynamic = 'force-dynamic';

export default function Page() {
return <Link href="/navigation">Go back home</Link>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Link from 'next/link';

export const dynamic = 'force-dynamic';

export default function Page() {
return <Link href="/navigation">Go back home</Link>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const dynamic = 'force-dynamic';

export default function Page() {
return <p>hello world</p>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const dynamic = 'force-dynamic';

export default function Page() {
return <p>hello world</p>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
'use client';

import Link from 'next/link';
import { useRouter } from 'next/navigation';

export default function Page() {
const router = useRouter();

return (
<ul>
<li>
<button
onClick={() => {
router.push('/navigation/42/router-push');
}}
>
router.push()
</button>
</li>
<li>
<button
onClick={() => {
router.replace('/navigation/42/router-replace');
}}
>
router.replace()
</button>
</li>
<li>
<button
onClick={() => {
router.forward();
}}
>
router.forward()
</button>
</li>
<li>
<button
onClick={() => {
router.back();
}}
>
router.back()
</button>
</li>
<li>
<Link href="/navigation/42/link">Normal Link</Link>
</li>
<li>
<Link href="/navigation/42/link-replace" replace>
Link Replace
</Link>
</li>
</ul>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,148 @@ test('Creates a navigation transaction for app router routes', async ({ page })
expect(await clientNavigationTransactionPromise).toBeDefined();
expect(await serverComponentTransactionPromise).toBeDefined();
});

test('Creates a navigation transaction for `router.push()`', async ({ page }) => {
const navigationTransactionPromise = waitForTransaction('nextjs-app-dir', transactionEvent => {
return (
transactionEvent?.transaction === `/navigation/42/router-push` &&
transactionEvent.contexts?.trace?.op === 'navigation' &&
transactionEvent.contexts.trace.data?.['navigation.type'] === 'router.push'
);
});

await page.goto('/navigation');
await page.waitForTimeout(3000);
await page.getByText('router.push()').click();

expect(await navigationTransactionPromise).toBeDefined();
});

test('Creates a navigation transaction for `router.replace()`', async ({ page }) => {
const navigationTransactionPromise = waitForTransaction('nextjs-app-dir', transactionEvent => {
return (
transactionEvent?.transaction === `/navigation/42/router-replace` &&
transactionEvent.contexts?.trace?.op === 'navigation' &&
transactionEvent.contexts.trace.data?.['navigation.type'] === 'router.replace'
);
});

await page.goto('/navigation');
await page.waitForTimeout(3000);
await page.getByText('router.replace()').click();

expect(await navigationTransactionPromise).toBeDefined();
});

test('Creates a navigation transaction for `router.back()`', async ({ page }) => {
const navigationTransactionPromise = waitForTransaction('nextjs-app-dir', transactionEvent => {
return (
transactionEvent?.transaction === `/navigation/1337/router-back` &&
transactionEvent.contexts?.trace?.op === 'navigation'
);
});

await page.goto('/navigation/1337/router-back');
await page.waitForTimeout(3000);
await page.getByText('Go back home').click();
await page.waitForTimeout(3000);
await page.getByText('router.back()').click();

expect(await navigationTransactionPromise).toMatchObject({
contexts: {
trace: {
data: {
'navigation.type': 'router.back',
},
},
},
});
});

test('Creates a navigation transaction for `router.forward()`', async ({ page }) => {
const navigationTransactionPromise = waitForTransaction('nextjs-app-dir', transactionEvent => {
return (
transactionEvent?.transaction === `/navigation/42/router-push` &&
transactionEvent.contexts?.trace?.op === 'navigation' &&
transactionEvent.contexts.trace.data?.['navigation.type'] === 'router.forward'
);
});

await page.goto('/navigation');
await page.waitForTimeout(3000);
await page.getByText('router.push()').click();
await page.waitForTimeout(3000);
await page.goBack();
await page.waitForTimeout(3000);
await page.getByText('router.forward()').click();

expect(await navigationTransactionPromise).toBeDefined();
});

test('Creates a navigation transaction for `<Link />`', async ({ page }) => {
const navigationTransactionPromise = waitForTransaction('nextjs-app-dir', transactionEvent => {
return (
transactionEvent?.transaction === `/navigation/42/link` &&
transactionEvent.contexts?.trace?.op === 'navigation' &&
transactionEvent.contexts.trace.data?.['navigation.type'] === 'router.push'
);
});

await page.goto('/navigation');
await page.getByText('Normal Link').click();

expect(await navigationTransactionPromise).toBeDefined();
});

test('Creates a navigation transaction for `<Link replace />`', async ({ page }) => {
const navigationTransactionPromise = waitForTransaction('nextjs-app-dir', transactionEvent => {
return (
transactionEvent?.transaction === `/navigation/42/link-replace` &&
transactionEvent.contexts?.trace?.op === 'navigation' &&
transactionEvent.contexts.trace.data?.['navigation.type'] === 'router.replace'
);
});

await page.goto('/navigation');
await page.waitForTimeout(3000);
await page.getByText('Link Replace').click();

expect(await navigationTransactionPromise).toBeDefined();
});

test('Creates a navigation transaction for browser-back', async ({ page }) => {
const navigationTransactionPromise = waitForTransaction('nextjs-app-dir', transactionEvent => {
return (
transactionEvent?.transaction === `/navigation/42/browser-back` &&
transactionEvent.contexts?.trace?.op === 'navigation' &&
transactionEvent.contexts.trace.data?.['navigation.type'] === 'browser.popstate'
);
});

await page.goto('/navigation/42/browser-back');
await page.waitForTimeout(3000);
await page.getByText('Go back home').click();
await page.waitForTimeout(3000);
await page.goBack();

expect(await navigationTransactionPromise).toBeDefined();
});

test('Creates a navigation transaction for browser-forward', async ({ page }) => {
const navigationTransactionPromise = waitForTransaction('nextjs-app-dir', transactionEvent => {
return (
transactionEvent?.transaction === `/navigation/42/router-push` &&
transactionEvent.contexts?.trace?.op === 'navigation' &&
transactionEvent.contexts.trace.data?.['navigation.type'] === 'browser.popstate'
);
});

await page.goto('/navigation');
await page.getByText('router.push()').click();
await page.waitForTimeout(3000);
await page.goBack();
await page.waitForTimeout(3000);
await page.goForward();

expect(await navigationTransactionPromise).toBeDefined();
});
1 change: 1 addition & 0 deletions dev-packages/node-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"connect": "^3.7.0",
"cors": "^2.8.5",
"cron": "^3.1.6",
"dataloader": "2.2.2",
"express": "^4.17.3",
"generic-pool": "^3.9.0",
"graphql": "^16.3.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const { loggingTransport, startExpressServerAndSendPortToRunner } = require('@sentry-internal/node-integration-tests');
const Sentry = require('@sentry/node');

Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
release: '1.0',
tracesSampleRate: 1.0,
transport: loggingTransport,
});

const PORT = 8008;

// Stop the process from exiting before the transaction is sent
setInterval(() => {}, 1000);

const run = async () => {
const express = require('express');
const Dataloader = require('dataloader');

const app = express();
const dataloader = new Dataloader(async keys => keys.map((_, idx) => idx), {
cache: false,
});

app.get('/', (req, res) => {
const user = dataloader.load('user-1');
res.send(user);
});

startExpressServerAndSendPortToRunner(app, PORT);
};

run();
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { cleanupChildProcesses, createRunner } from '../../../utils/runner';

describe('dataloader auto-instrumentation', () => {
afterAll(async () => {
cleanupChildProcesses();
});

const EXPECTED_TRANSACTION = {
transaction: 'GET /',
spans: expect.arrayContaining([
expect.objectContaining({
data: expect.objectContaining({
'sentry.origin': 'auto.db.otel.dataloader',
'sentry.op': 'cache.get',
}),
description: 'dataloader.load',
origin: 'auto.db.otel.dataloader',
op: 'cache.get',
status: 'ok',
}),
expect.objectContaining({
data: expect.objectContaining({
'sentry.origin': 'auto.db.otel.dataloader',
'sentry.op': 'cache.get',
}),
description: 'dataloader.batch',
origin: 'auto.db.otel.dataloader',
op: 'cache.get',
status: 'ok',
}),
]),
};

test('should auto-instrument `dataloader` package.', done => {
createRunner(__dirname, 'scenario.js')
.expect({ transaction: EXPECTED_TRANSACTION })
.start(done)
.makeRequest('get', '/');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const { loggingTransport } = require('@sentry-internal/node-integration-tests');
const Sentry = require('@sentry/node');

Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
release: '1.0',
transport: loggingTransport,
beforeSend(event) {
event.contexts = {
...event.contexts,
traceData: {
...Sentry.getTraceData(),
metaTags: Sentry.getTraceMetaTags(),
},
};
return event;
},
});

Sentry.captureException(new Error('test error'));
Loading

0 comments on commit 366cb67

Please sign in to comment.