Skip to content

Commit

Permalink
Merge branch 'develop' into sig/astro-waitUntil
Browse files Browse the repository at this point in the history
  • Loading branch information
s1gr1d authored Oct 29, 2024
2 parents 2621c02 + 22c3865 commit 27e4a18
Show file tree
Hide file tree
Showing 82 changed files with 726 additions and 3,746 deletions.
7 changes: 2 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@ updates:
schedule:
interval: 'weekly'
allow:
- dependency-name: "@sentry/cli"
- dependency-name: "@sentry/vite-plugin"
- dependency-name: "@sentry/webpack-plugin"
- dependency-name: "@sentry/rollup-plugin"
- dependency-name: "@sentry/esbuild-plugin"
- dependency-name: "@sentry/*"
- dependency-name: "@opentelemetry/*"
- dependency-name: "@prisma/instrumentation"
- dependency-name: "opentelemetry-instrumentation-remix"
versioning-strategy: increase
commit-message:
prefix: feat
Expand Down
50 changes: 4 additions & 46 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ jobs:
with:
node-version-file: 'package.json'
- name: Set up Deno
uses: denoland/setup-deno@v1.5.1
uses: denoland/setup-deno@v2.0.1
with:
deno-version: v1.38.5
- name: Restore caches
Expand Down Expand Up @@ -858,7 +858,7 @@ jobs:
if: always() && needs.job_e2e_prepare.result == 'success'
needs: [job_get_metadata, job_build, job_e2e_prepare]
runs-on: ubuntu-20.04
timeout-minutes: 10
timeout-minutes: 15
env:
# We just use a dummy DSN here, only send to the tunnel anyhow
E2E_TEST_DSN: 'https://username@domain/123'
Expand Down Expand Up @@ -1070,7 +1070,7 @@ jobs:
github.actor != 'dependabot[bot]'
needs: [job_get_metadata, job_build, job_e2e_prepare]
runs-on: ubuntu-20.04
timeout-minutes: 10
timeout-minutes: 15
env:
E2E_TEST_AUTH_TOKEN: ${{ secrets.E2E_TEST_AUTH_TOKEN }}
E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }}
Expand Down Expand Up @@ -1234,7 +1234,7 @@ jobs:
)
needs: [job_get_metadata, job_build, job_e2e_prepare]
runs-on: ubuntu-20.04
timeout-minutes: 10
timeout-minutes: 15
env:
E2E_TEST_AUTH_TOKEN: ${{ secrets.E2E_TEST_AUTH_TOKEN }}
E2E_TEST_DSN: ${{ secrets.E2E_TEST_DSN }}
Expand Down Expand Up @@ -1345,48 +1345,6 @@ jobs:
run: |
echo "One of the dependent jobs have failed. You may need to re-run it." && exit 1
overhead_metrics:
name: Overhead metrics
needs: [job_get_metadata, job_build]
runs-on: ubuntu-20.04
timeout-minutes: 30
if: |
contains(github.event.pull_request.labels.*.name, 'ci-overhead-measurements')
steps:
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
uses: actions/checkout@v4
with:
ref: ${{ env.HEAD_COMMIT }}
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
- name: Restore caches
uses: ./.github/actions/restore-cache
with:
dependency_cache_key: ${{ needs.job_build.outputs.dependency_cache_key }}

- name: Collect
run: yarn ci:collect
working-directory: dev-packages/overhead-metrics

- name: Process
id: process
run: yarn ci:process
working-directory: dev-packages/overhead-metrics
# Don't run on forks - the PR comment cannot be added.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Upload results
uses: actions/upload-artifact@v4
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
with:
name: ${{ steps.process.outputs.artifactName }}
path: ${{ steps.process.outputs.artifactPath }}
retention-days: 7

job_compile_bindings_profiling_node:
name: Compile & Test Profiling Bindings (v${{ matrix.node }}) ${{ matrix.target_platform || matrix.os }}, ${{ matrix.node || matrix.container }}, ${{ matrix.arch || matrix.container }}, ${{ contains(matrix.container, 'alpine') && 'musl' || 'glibc' }}
needs: [job_get_metadata, job_build]
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ name: 'CI: CodeQL'
on:
push:
branches: [develop]
branches-ignore:
# Ignore dependabot branches
- "dependabot/**"
pull_request:
# The branches below must be a subset of the branches above
branches: [develop]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as Sentry from '@sentry/browser';

window.Sentry = Sentry;

window.fetchCallCount = 0;
window.spanEnded = false;

const originalWindowFetch = window.fetch;
window.fetch = (...args) => {
window.fetchCallCount++;
return originalWindowFetch(...args);
};

Sentry.init({
dsn: 'https://[email protected]/1337',
tracesSampleRate: 1.0,
enabled: false,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Sentry.startSpan({ name: 'standalone_segment_span', experimental: { standalone: true } }, () => {});

window.spanEnded = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { expect } from '@playwright/test';

import { sentryTest } from '../../../../utils/fixtures';
import { shouldSkipTracingTest } from '../../../../utils/helpers';

sentryTest("doesn't send a standalone span envelope if SDK is disabled", async ({ getLocalTestPath, page }) => {
if (shouldSkipTracingTest()) {
sentryTest.skip();
}

const url = await getLocalTestPath({ testDir: __dirname });
await page.goto(url);

// @ts-expect-error this exists in the test init/subject
await page.waitForFunction(() => !!window.spanEnded);
await page.waitForTimeout(2000);

// @ts-expect-error this exists in the test init
const fetchCallCount = await page.evaluate(() => window.fetchCallCount);
// We expect no fetch calls because the SDK is disabled
expect(fetchCallCount).toBe(0);
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@sentry/node": "latest || *"
},
"devDependencies": {
"rollup": "^4.0.2",
"rollup": "^4.24.2",
"vitest": "^0.34.6",
"@sentry/rollup-plugin": "2.22.6"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import * as Sentry from '@sentry/nextjs';

Sentry.init({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import * as Sentry from '@sentry/nextjs';

Sentry.init({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import * as Sentry from '@sentry/nextjs';

Sentry.init({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import * as Sentry from '@sentry/nextjs';

Sentry.init({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import * as Sentry from '@sentry/nextjs';

Sentry.init({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { HackComponentToRunSideEffectsInSentryClientConfig } from '../sentry.client.config';

export default function Layout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>{children}</body>
<body>
<HackComponentToRunSideEffectsInSentryClientConfig />
{children}
</body>
</html>
);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default function Page() {
<p>Hello World!</p>;
}

// getServerSideProps makes this page dynamic and allows tracing data to be inserted
export async function getServerSideProps() {
return {
props: {},
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { AppProps } from 'next/app';
import '../sentry.client.config';

export default function CustomApp({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />;
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
'use client';

import * as Sentry from '@sentry/nextjs';

Sentry.init({
environment: 'qa', // dynamic sampling bias to keep transactions
dsn: process.env.NEXT_PUBLIC_E2E_TEST_DSN,
tunnel: `http://localhost:3031/`, // proxy server
tracesSampleRate: 1.0,
sendDefaultPii: true,
});
if (typeof window !== 'undefined') {
Sentry.init({
environment: 'qa', // dynamic sampling bias to keep transactions
dsn: process.env.NEXT_PUBLIC_E2E_TEST_DSN,
tunnel: `http://localhost:3031/`, // proxy server
tracesSampleRate: 1.0,
sendDefaultPii: true,
});
}

export function HackComponentToRunSideEffectsInSentryClientConfig() {
return null;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { expect, test } from '@playwright/test';
import { waitForTransaction } from '@sentry-internal/test-utils';

test('Should propagate traces from server to client in pages router', async ({ page }) => {
const serverTransactionPromise = waitForTransaction('nextjs-turbo', async transactionEvent => {
return transactionEvent?.transaction === 'GET /[param]/pages-router-client-trace-propagation';
});

const pageloadTransactionPromise = waitForTransaction('nextjs-turbo', async transactionEvent => {
return transactionEvent?.transaction === '/[param]/pages-router-client-trace-propagation';
});

await page.goto(`/123/pages-router-client-trace-propagation`);

const serverTransaction = await serverTransactionPromise;
const pageloadTransaction = await pageloadTransactionPromise;

expect(serverTransaction.contexts?.trace?.trace_id).toBeDefined();
expect(pageloadTransaction.contexts?.trace?.trace_id).toBe(serverTransaction.contexts?.trace?.trace_id);
});
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@typescript-eslint/parser": "^7.2.0",
"@vitejs/plugin-react-swc": "^3.5.0",
"typescript": "^5.2.2",
"vite": "^5.2.0",
"vite": "^5.2.14",
"@playwright/test": "^1.44.1",
"@sentry-internal/test-utils": "link:../../../test-utils"
},
Expand Down
Loading

0 comments on commit 27e4a18

Please sign in to comment.