Skip to content

Commit

Permalink
Merge branch 'develop' into onur/dataloader-integration
Browse files Browse the repository at this point in the history
  • Loading branch information
onurtemizkan authored Sep 11, 2024
2 parents a247f50 + e944daa commit e95324d
Show file tree
Hide file tree
Showing 101 changed files with 1,079 additions and 378 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: 'dev-packages/e2e-tests/package.json'
node-version: 22
- name: Restore caches
uses: ./.github/actions/restore-cache
with:
Expand Down
98 changes: 98 additions & 0 deletions .github/workflows/project-automation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: "Automation: Update GH Project"
on:
pull_request:
types:
- closed
- opened
- reopened
- ready_for_review
- converted_to_draft

jobs:
# Check if PR is in project
check_project:
name: Check if PR is in project
runs-on: ubuntu-latest
steps:
- name: Check if PR is in project
continue-on-error: true
id: check_project
uses: github/update-project-action@f980378bc179626af5b4e20ec05ec39c7f7a6f6d
with:
github_token: ${{ secrets.GH_PROJECT_AUTOMATION }}
organization: getsentry
project_number: 31
content_id: ${{ github.event.pull_request.node_id }}
field: Status
operation: read

- name: If project field is read, set is_in_project to 1
if: steps.check_project.outputs.field_read_value
id: is_in_project
run: echo "is_in_project=1" >> "$GITHUB_OUTPUT"

outputs:
is_in_project: ${{ steps.is_in_project.outputs.is_in_project || '0' }}

# When a PR is a draft, it should go into "In Progress"
mark_as_in_progress:
name: "Mark as In Progress"
needs: check_project
if: |
needs.check_project.outputs.is_in_project == '1'
&& (github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'converted_to_draft')
&& github.event.pull_request.draft == true
runs-on: ubuntu-latest
steps:
- name: Update status to in_progress
uses: github/update-project-action@f980378bc179626af5b4e20ec05ec39c7f7a6f6d
with:
github_token: ${{ secrets.GH_PROJECT_AUTOMATION }}
organization: getsentry
project_number: 31
content_id: ${{ github.event.pull_request.node_id }}
field: Status
value: "🏗 In Progress"

# When a PR is not a draft, it should go into "In Review"
mark_as_in_review:
name: "Mark as In Review"
needs: check_project
if: |
needs.check_project.outputs.is_in_project == '1'
&& (github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'ready_for_review')
&& github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Update status to in_review
id: update_status
uses: github/update-project-action@f980378bc179626af5b4e20ec05ec39c7f7a6f6d
with:
github_token: ${{ secrets.GH_PROJECT_AUTOMATION }}
organization: getsentry
project_number: 31
content_id: ${{ github.event.pull_request.node_id }}
field: Status
value: "👀 In Review"

# By default, closed PRs go into "Ready for Release"
# But if they are closed without merging, they should go into "Done"
mark_as_done:
name: "Mark as Done"
needs: check_project
if: |
needs.check_project.outputs.is_in_project == '1'
&& github.event.action == 'closed' && github.event.pull_request.merged == false
runs-on: ubuntu-latest
steps:
- name: Update status to done
id: update_status
uses: github/update-project-action@f980378bc179626af5b4e20ec05ec39c7f7a6f6d
with:
github_token: ${{ secrets.GH_PROJECT_AUTOMATION }}
organization: getsentry
project_number: 31
content_id: ${{ github.event.pull_request.node_id }}
field: Status
value: "✅ Done"

34 changes: 33 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,38 @@

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

## 8.30.0

### Important Changes

- _feat(node): Add `kafkajs` integration (#13528)_

This release adds a new integration that instruments `kafkajs` library with spans and traces. This integration is
automatically enabled by default, but can be included with the `Sentry.kafkaIntegration()` import.

```js
Sentry.init({
integrations: [Sentry.kafkaIntegration()],
});
```

### Other Changes

- feat(core): Allow adding measurements without global client (#13612)
- feat(deps): Bump @opentelemetry/instrumentation-undici from 0.5.0 to 0.6.0 (#13622)
- feat(deps): Bump @sentry/cli from 2.33.0 to 2.35.0 (#13624)
- feat(node): Use `@opentelemetry/instrumentation-undici` for fetch tracing (#13485)
- feat(nuxt): Add server config to root folder (#13583)
- feat(otel): Upgrade @opentelemetry/semantic-conventions to 1.26.0 (#13631)
- fix(browser): check supportedEntryTypes before caling the function (#13541)
- fix(browser): Ensure Standalone CLS span timestamps are correct (#13649)
- fix(nextjs): Widen removal of 404 transactions (#13628)
- fix(node): Remove ambiguity and race conditions when matching local variables to exceptions (#13501)
- fix(node): Update OpenTelemetry instrumentation package for solidstart and opentelemetry (#13640)
- fix(node): Update OpenTelemetry instrumentation package for solidstart and opentelemetry (#13642)
- fix(vue): Ensure Vue `trackComponents` list matches components with or without `<>` (#13543)
- ref(profiling): Conditionally shim cjs globals (#13267)

Work in this release was contributed by @Zen-cronic and @odanado. Thank you for your contributions!

## 8.29.0
Expand All @@ -34,7 +66,7 @@ import * as Sentry from '@sentry/node';

Sentry.init({
dsn: '__PUBLIC_DSN__',
registerEsmLoaderHooks: { onlyHookedModules: true },
registerEsmLoaderHooks: { onlyIncludeInstrumentedModules: true },
});
```

Expand Down
4 changes: 2 additions & 2 deletions dev-packages/browser-integration-tests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry-internal/browser-integration-tests",
"version": "8.29.0",
"version": "8.30.0",
"main": "index.js",
"license": "MIT",
"engines": {
Expand Down Expand Up @@ -43,7 +43,7 @@
"@babel/preset-typescript": "^7.16.7",
"@playwright/test": "^1.44.1",
"@sentry-internal/rrweb": "2.11.0",
"@sentry/browser": "8.29.0",
"@sentry/browser": "8.30.0",
"axios": "1.6.7",
"babel-loader": "^8.2.2",
"html-webpack-plugin": "^5.5.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,3 +453,44 @@ sentryTest("doesn't send further CLS after the first page hide", async ({ getLoc
// a timeout or something similar.
await navigationTxnPromise;
});

sentryTest('CLS span timestamps are set correctly', async ({ getLocalTestPath, page }) => {
const url = await getLocalTestPath({ testDir: __dirname });

const eventData = await getFirstSentryEnvelopeRequest<SentryEvent>(page, url);

expect(eventData.type).toBe('transaction');
expect(eventData.contexts?.trace?.op).toBe('pageload');
expect(eventData.timestamp).toBeDefined();

const pageloadEndTimestamp = eventData.timestamp!;

const spanEnvelopePromise = getMultipleSentryEnvelopeRequests<SpanEnvelope>(
page,
1,
{ envelopeType: 'span' },
properFullEnvelopeRequestParser,
);

await triggerAndWaitForLayoutShift(page);

await hidePage(page);

const spanEnvelope = (await spanEnvelopePromise)[0];
const spanEnvelopeItem = spanEnvelope[1][0][1];

expect(spanEnvelopeItem.start_timestamp).toBeDefined();
expect(spanEnvelopeItem.timestamp).toBeDefined();

const clsSpanStartTimestamp = spanEnvelopeItem.start_timestamp!;
const clsSpanEndTimestamp = spanEnvelopeItem.timestamp!;

// CLS performance entries have no duration ==> start and end timestamp should be the same
expect(clsSpanStartTimestamp).toEqual(clsSpanEndTimestamp);

// We don't really care that they are very close together but rather about the order of magnitude
// Previously, we had a bug where the timestamps would be significantly off (by multiple hours)
// so we only ensure that this bug is fixed. 60 seconds should be more than enough.
expect(clsSpanStartTimestamp - pageloadEndTimestamp).toBeLessThan(60);
expect(clsSpanStartTimestamp).toBeGreaterThan(pageloadEndTimestamp);
});
2 changes: 1 addition & 1 deletion dev-packages/bundle-analyzer-scenarios/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry-internal/bundle-analyzer-scenarios",
"version": "8.29.0",
"version": "8.30.0",
"description": "Scenarios to test bundle analysis with",
"repository": "git://github.com/getsentry/sentry-javascript.git",
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/dev-packages/bundle-analyzer-scenarios",
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/clear-cache-gh-action/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sentry-internal/clear-cache-gh-action",
"description": "An internal Github Action to clear GitHub caches.",
"version": "8.29.0",
"version": "8.30.0",
"license": "MIT",
"engines": {
"node": ">=18"
Expand Down
4 changes: 2 additions & 2 deletions dev-packages/e2e-tests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry-internal/e2e-tests",
"version": "8.29.0",
"version": "8.30.0",
"license": "MIT",
"private": true,
"scripts": {
Expand All @@ -14,7 +14,7 @@
"test:prepare": "ts-node prepare.ts",
"test:validate": "run-s test:validate-configuration test:validate-test-app-setups",
"clean": "rimraf tmp node_modules pnpm-lock.yaml && yarn clean:test-applications",
"clean:test-applications": "rimraf test-applications/**/{node_modules,dist,build,.next,.sveltekit,pnpm-lock.yaml} .last-run.json && pnpm store prune"
"clean:test-applications": "rimraf --glob test-applications/**/{node_modules,dist,build,.next,.sveltekit,pnpm-lock.yaml} .last-run.json && pnpm store prune"
},
"devDependencies": {
"@types/glob": "8.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { test } from '@playwright/test';
import { waitForTransaction } from '@sentry-internal/test-utils';

test('should create a transaction for a CJS pages router API endpoint', async ({ page }) => {
let received404Transaction = false;
waitForTransaction('nextjs-13', async transactionEvent => {
return transactionEvent.transaction === 'GET /404' || transactionEvent.transaction === 'GET /_not-found';
}).then(() => {
received404Transaction = true;
});

await page.goto('/page-that-doesnt-exist');

await new Promise<void>((resolve, reject) => {
setTimeout(() => {
if (received404Transaction) {
reject(new Error('received 404 transaction'));
} else {
resolve();
}
}, 5_000);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test('Should emit a span for a generateMetadata() function invokation', async ({
expect(transaction.spans).toContainEqual(
expect.objectContaining({
description: 'generateMetadata /generation-functions/page',
origin: 'manual',
origin: 'auto',
parent_span_id: expect.any(String),
span_id: expect.any(String),
status: 'ok',
Expand Down Expand Up @@ -74,7 +74,7 @@ test('Should send a transaction event for a generateViewport() function invokati
expect((await transactionPromise).spans).toContainEqual(
expect.objectContaining({
description: 'generateViewport /generation-functions/page',
origin: 'manual',
origin: 'auto',
parent_span_id: expect.any(String),
span_id: expect.any(String),
status: 'ok',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Because bundlers can now predetermine a static set of binaries we need to ensure those binaries
// actually exists, else we risk a compile time error when bundling the package. This could happen
// if we added a new binary in cpu_profiler.ts, but forgot to prebuild binaries for it. Because CI
// only runs integration and unit tests, this change would be missed and could end up in a release.
// Therefor, once all binaries are precompiled in CI and tests pass, run esbuild with bundle:true
// which will copy all binaries to the outfile folder and throw if any of them are missing.
import esbuild from 'esbuild';

console.log('Running build using esbuild version', esbuild.version);

esbuild.buildSync({
platform: 'node',
entryPoints: ['./index.ts'],
outfile: './dist/index.shimmed.mjs',
target: 'esnext',
format: 'esm',
bundle: true,
loader: { '.node': 'copy' },
banner: {
js: `
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
`,
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"private": true,
"scripts": {
"typecheck": "tsc --noEmit",
"build": "node build.mjs",
"test": "npm run build && node dist/index.js",
"clean": "npx rimraf node_modules",
"build": "node build.mjs && node build.shimmed.mjs",
"test": "node dist/index.js && node --experimental-require-module dist/index.js && node dist/index.shimmed.mjs",
"clean": "npx rimraf node_modules dist",
"test:build": "npm run typecheck && npm run build",
"test:assert": "npm run test"
},
Expand Down
2 changes: 1 addition & 1 deletion dev-packages/external-contributor-gh-action/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sentry-internal/external-contributor-gh-action",
"description": "An internal Github Action to add external contributors to the CHANGELOG.md file.",
"version": "8.29.0",
"version": "8.30.0",
"license": "MIT",
"engines": {
"node": ">=18"
Expand Down
11 changes: 6 additions & 5 deletions dev-packages/node-integration-tests/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sentry-internal/node-integration-tests",
"version": "8.29.0",
"version": "8.30.0",
"license": "MIT",
"engines": {
"node": ">=14.18"
Expand Down Expand Up @@ -31,10 +31,10 @@
"@nestjs/core": "^10.3.3",
"@nestjs/platform-express": "^10.3.3",
"@prisma/client": "5.9.1",
"@sentry/aws-serverless": "8.29.0",
"@sentry/node": "8.29.0",
"@sentry/types": "8.29.0",
"@sentry/utils": "8.29.0",
"@sentry/aws-serverless": "8.30.0",
"@sentry/node": "8.30.0",
"@sentry/types": "8.30.0",
"@sentry/utils": "8.30.0",
"@types/mongodb": "^3.6.20",
"@types/mysql": "^2.15.21",
"@types/pg": "^8.6.5",
Expand All @@ -49,6 +49,7 @@
"graphql": "^16.3.0",
"http-terminator": "^3.2.0",
"ioredis": "^5.4.1",
"kafkajs": "2.2.4",
"mongodb": "^3.7.3",
"mongodb-memory-server-global": "^7.6.3",
"mongoose": "^5.13.22",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
db:
image: apache/kafka:latest
restart: always
container_name: integration-tests-kafka
ports:
- '9092:9092'
Loading

0 comments on commit e95324d

Please sign in to comment.