Skip to content

Commit

Permalink
Merge pull request #10405 from getsentry/prepare-release/7.99.0
Browse files Browse the repository at this point in the history
meta(changelog): Update changelog for 7.99.0
  • Loading branch information
Lms24 authored Jan 30, 2024
2 parents f296747 + 818d959 commit 29998a5
Show file tree
Hide file tree
Showing 223 changed files with 5,239 additions and 1,169 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ jobs:
'generic-ts3.8',
'node-experimental-fastify-app',
'node-hapi-app',
'node-exports-test-app',
]
build-command:
- false
Expand Down Expand Up @@ -946,6 +947,9 @@ jobs:
uses: actions/setup-node@v4
with:
node-version-file: 'dev-packages/e2e-tests/package.json'
- name: Set up Bun
if: matrix.test-application == 'node-exports-test-app'
uses: oven-sh/setup-bun@v1
- name: Restore caches
uses: ./.github/actions/restore-cache
env:
Expand Down
7 changes: 7 additions & 0 deletions .size-limit.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ module.exports = [
gzip: true,
limit: '35 KB',
},
{
name: '@sentry/browser (incl. browserTracingIntegration) - Webpack (gzipped)',
path: 'packages/browser/build/npm/esm/index.js',
import: '{ init, browserTracingIntegration }',
gzip: true,
limit: '35 KB',
},
{
name: '@sentry/browser (incl. Feedback) - Webpack (gzipped)',
path: 'packages/browser/build/npm/esm/index.js',
Expand Down
41 changes: 39 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,43 @@

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

## 7.99.0

### Important Changes

#### Deprecations

This release includes some deprecations for span related methods and integrations in our Deno SDK, `@sentry/deno`. For
more details please look at our
[migration guide](https://github.com/getsentry/sentry-javascript/blob/develop/MIGRATION.md).

- feat(core): Deprecate `Span.setHttpStatus` in favor of `setHttpStatus` (#10268)
- feat(core): Deprecate `spanStatusfromHttpCode` in favour of `getSpanStatusFromHttpCode` (#10361)
- feat(core): Deprecate `StartSpanOptions.origin` in favour of passing attribute (#10274)
- feat(deno): Expose functional integrations to replace classes (#10355)

### Other Changes

- feat(bun): Add missing `@sentry/node` re-exports (#10396)
- feat(core): Add `afterAllSetup` hook for integrations (#10345)
- feat(core): Ensure `startSpan()` can handle spans that require parent (#10386)
- feat(core): Read propagation context off scopes in `startSpan` APIs (#10300)
- feat(remix): Export missing `@sentry/node` functions (#10385, #10391)
- feat(serverless): Add missing `@sentry/node` re-exports (#10390)
- feat(sveltekit): Add more missing `@sentry/node` re-exports (#10392)
- feat(tracing): Export proper type for browser tracing (#10411)
- feat(tracing): Expose new `browserTracingIntegration` (#10351)
- fix: Ensure `afterAllSetup` is called when using `addIntegration()` (#10372)
- fix(core): Export `spanToTraceContext` function from span utils (#10364)
- fix(core): Make `FunctionToString` integration use SETUP_CLIENTS weakmap (#10358)
- fix(deno): Call function if client is not setup (#10354)
- fix(react): Fix attachReduxState option (#10381)
- fix(spotlight): Use unpatched http.request (#10369)
- fix(tracing): Only create request span if there is active span (#10375)
- ref: Read propagation context off of scope and isolation scope when propagating and applying trace context (#10297)

Work in this release contributed by @AleshaOleg. Thank you for your contribution!

## 7.98.0

This release primarily fixes some type declaration errors:
Expand All @@ -20,7 +57,7 @@ Note: The 7.96.0 release was incomplete. This release is partially encompassing

## 7.96.0

Note: This release was incomplete. Not all Sentry SDK packages were released for this version. Please upgrade to 7.97.0
Note: This release was incomplete. Not all Sentry SDK packages were released for this version. Please upgrade to 7.98.0
directly.

### Important Changes
Expand Down Expand Up @@ -1103,7 +1140,7 @@ finished. This is useful for event emitters or similar.
function middleware(_req, res, next) {
return Sentry.startSpanManual({ name: 'middleware' }, (span, finish) => {
res.once('finish', () => {
span?.setHttpStatus(res.status);
setHttpStatus(span, res.status);
finish();
});
return next();
Expand Down
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ able to use it. From the top level of the repo, there are three commands availab
dependencies (`utils`, `core`, `browser`, etc), and all packages which depend on it (currently `gatsby` and `nextjs`))
- `yarn build:dev:watch`, which runs `yarn build:dev` in watch mode (recommended)

You can also run a production build via `yarn build`, which will build everything except for the tarballs for publishing
to NPM. You can use this if you want to bundle Sentry yourself. The build output can be found in the packages `build/`
folder, e.g. `packages/browser/build`. Bundled files can be found in `packages/browser/build/bundles`. Note that there
are no guarantees about the produced file names etc., so make sure to double check which files are generated after
upgrading.

## Testing SDK Packages Locally

To test local versions of SDK packages, for instance in test projects, you have a couple of options:
Expand Down
7 changes: 5 additions & 2 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,15 @@ The following list shows how integrations should be migrated:
| `new RewriteFrames()` | `rewriteFramesIntegration()` | `@sentry/integrations` |
| `new SessionTiming()` | `sessionTimingIntegration()` | `@sentry/integrations` |
| `new HttpClient()` | `httpClientIntegration()` | `@sentry/integrations` |
| `new ContextLines()` | `contextLinesIntegration()` | `@sentry/browser` |
| `new ContextLines()` | `contextLinesIntegration()` | `@sentry/browser`, `@sentry/deno` |
| `new Breadcrumbs()` | `breadcrumbsIntegration()` | `@sentry/browser`, `@sentry/deno` |
| `new GlobalHandlers()` | `globalHandlersIntegration()` | `@sentry/browser` |
| `new GlobalHandlers()` | `globalHandlersIntegration()` | `@sentry/browser` , `@sentry/deno` |
| `new HttpContext()` | `httpContextIntegration()` | `@sentry/browser` |
| `new TryCatch()` | `browserApiErrorsIntegration()` | `@sentry/browser`, `@sentry/deno` |
| `new VueIntegration()` | `vueIntegration()` | `@sentry/vue` |
| `new DenoContext()` | `denoContextIntegration()` | `@sentry/deno` |
| `new DenoCron()` | `denoCronIntegration()` | `@sentry/deno` |
| `new NormalizePaths()` | `normalizePathsIntegration()` | `@sentry/deno` |

## Deprecate `hub.bindClient()` and `makeMain()`

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ convenient interface and improved consistency between various JavaScript environ
- [Supported Platforms](#supported-platforms)
- [Installation and Usage](#installation-and-usage)
- [Other Packages](#other-packages)
- [Bug Bounty Program](#bug-bounty-program)

## Supported Platforms

Expand Down Expand Up @@ -104,3 +105,12 @@ below:
utility functions useful for various SDKs.
- [`@sentry/types`](https://github.com/getsentry/sentry-javascript/tree/master/packages/types): Types used in all
packages.

## Bug Bounty Program

Our bug bounty program aims to improve the security of our open source projects by encouraging the community to identify and report potential security vulnerabilities. Your reward will depend on the severity of the identified vulnerability.

Our program is currently running on an invitation basis. If you're interested in participating, please send us an email to security@sentry.io and tell us, that you are interested in auditing this repository.

For more details, please have a look at https://sentry.io/security/#vulnerability-disclosure.

5 changes: 4 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,11 @@
"dev-packages/browser-integration-tests/suites/**/*.json",
"dev-packages/browser-integration-tests/loader-suites/**/*.js",
"dev-packages/browser-integration-tests/suites/stacktraces/**/*.js",
".next/**/*",
"**/fixtures/*/*.json",
"**/*.min.js"
"**/*.min.js",
".next/**",
".svelte-kit/**"
]
},
"javascript": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as Sentry from '@sentry/browser';

window.Sentry = Sentry;

// Replay should not actually work, but still not error out
window.Replay = new Sentry.replayIntegration({
flushMinDelay: 200,
flushMaxDelay: 200,
minReplayDuration: 0,
});

Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
sampleRate: 1,
replaysSessionSampleRate: 1.0,
replaysOnErrorSampleRate: 0.0,
integrations: [window.Replay],
});

// Ensure none of these break
window.Replay.start();
window.Replay.stop();
window.Replay.flush();
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<button onclick="console.log('Test log')">Click me</button>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { expect } from '@playwright/test';

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

sentryTest(
'exports a shim replayIntegration integration for non-replay bundles',
async ({ getLocalTestPath, page, forceFlushReplay }) => {
const bundle = process.env.PW_BUNDLE;

if (!bundle || !bundle.startsWith('bundle_') || bundle.includes('replay')) {
sentryTest.skip();
}

const consoleMessages: string[] = [];
page.on('console', msg => consoleMessages.push(msg.text()));

let requestCount = 0;
await page.route('https://dsn.ingest.sentry.io/**/*', route => {
requestCount++;
return route.fulfill({
status: 200,
contentType: 'application/json',
body: JSON.stringify({ id: 'test-id' }),
});
});

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

await page.goto(url);
await forceFlushReplay();

expect(requestCount).toBe(0);
expect(consoleMessages).toEqual(['You are using new Replay() even though this bundle does not include replay.']);
},
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as Sentry from '@sentry/browser';

window.Sentry = Sentry;

Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
integrations: [Sentry.browserTracingIntegration({ idleTimeout: 9000 })],
tracesSampleRate: 1,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
document.getElementById('go-background').addEventListener('click', () => {
Object.defineProperty(document, 'hidden', { value: true, writable: true });
const ev = document.createEvent('Event');
ev.initEvent('visibilitychange');
document.dispatchEvent(ev);
});

document.getElementById('start-transaction').addEventListener('click', () => {
window.transaction = Sentry.startTransaction({ name: 'test-transaction' });
Sentry.getCurrentHub().configureScope(scope => scope.setSpan(window.transaction));
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<button id="start-transaction">Start Transaction</button>
<button id="go-background">New Tab</button>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import type { JSHandle } from '@playwright/test';
import { expect } from '@playwright/test';
import type { Event } from '@sentry/types';

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

async function getPropertyValue(handle: JSHandle, prop: string) {
return (await handle.getProperty(prop))?.jsonValue();
}

sentryTest('should finish a custom transaction when the page goes background', async ({ getLocalTestPath, page }) => {
if (shouldSkipTracingTest()) {
sentryTest.skip();
}

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

const pageloadTransaction = await getFirstSentryEnvelopeRequest<Event>(page, url);
expect(pageloadTransaction).toBeDefined();

await page.locator('#start-transaction').click();
const transactionHandle = await page.evaluateHandle('window.transaction');

const id_before = await getPropertyValue(transactionHandle, 'span_id');
const name_before = await getPropertyValue(transactionHandle, 'name');
const status_before = await getPropertyValue(transactionHandle, 'status');
const tags_before = await getPropertyValue(transactionHandle, 'tags');

expect(name_before).toBe('test-transaction');
expect(status_before).toBeUndefined();
expect(tags_before).toStrictEqual({});

await page.locator('#go-background').click();

const id_after = await getPropertyValue(transactionHandle, 'span_id');
const name_after = await getPropertyValue(transactionHandle, 'name');
const status_after = await getPropertyValue(transactionHandle, 'status');
const tags_after = await getPropertyValue(transactionHandle, 'tags');

expect(id_before).toBe(id_after);
expect(name_after).toBe(name_before);
expect(status_after).toBe('cancelled');
expect(tags_after).toStrictEqual({ visibilitychange: 'document.hidden' });
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
document.getElementById('go-background').addEventListener('click', () => {
setTimeout(() => {
Object.defineProperty(document, 'hidden', { value: true, writable: true });
const ev = document.createEvent('Event');
ev.initEvent('visibilitychange');
document.dispatchEvent(ev);
}, 250);
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<button id="go-background">New Tab</button>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { expect } from '@playwright/test';
import type { Event } from '@sentry/types';

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

sentryTest('should finish pageload transaction when the page goes background', async ({ getLocalTestPath, page }) => {
if (shouldSkipTracingTest()) {
sentryTest.skip();
}
const url = await getLocalTestPath({ testDir: __dirname });

await page.goto(url);
await page.locator('#go-background').click();

const pageloadTransaction = await getFirstSentryEnvelopeRequest<Event>(page);

expect(pageloadTransaction.contexts?.trace?.op).toBe('pageload');
expect(pageloadTransaction.contexts?.trace?.status).toBe('cancelled');
expect(pageloadTransaction.contexts?.trace?.tags).toMatchObject({
visibilitychange: 'document.hidden',
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import * as Sentry from '@sentry/browser';

window.Sentry = Sentry;

Sentry.init({
dsn: 'https://public@dsn.ingest.sentry.io/1337',
integrations: [
Sentry.browserTracingIntegration({
idleTimeout: 1000,
_experiments: {
enableHTTPTimings: true,
},
}),
],
tracesSampleRate: 1,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fetch('http://example.com/0').then(fetch('http://example.com/1').then(fetch('http://example.com/2')));
Loading

0 comments on commit 29998a5

Please sign in to comment.