Skip to content

Commit

Permalink
Merge pull request #9397 from getsentry/prepare-release/7.76.0
Browse files Browse the repository at this point in the history
meta(changelog): Update changelog for 7.76.0
  • Loading branch information
lforst authored Oct 27, 2023
2 parents 241e3b6 + 8b76c18 commit 13fe88a
Show file tree
Hide file tree
Showing 62 changed files with 682 additions and 282 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -817,13 +817,20 @@ jobs:
uses: ./.github/actions/restore-cache
env:
DEPENDENCY_CACHE_KEY: ${{ needs.job_build.outputs.dependency_cache_key }}
- name: Check tarball cache
uses: actions/cache@v3
- name: NX cache
uses: actions/cache/restore@v3
with:
path: ${{ github.workspace }}/packages/*/*.tgz
key: ${{ env.BUILD_CACHE_TARBALL_KEY }}
path: .nxcache
key: nx-Linux-${{ github.ref }}-${{ env.HEAD_COMMIT }}
# On develop branch, we want to _store_ the cache (so it can be used by other branches), but never _restore_ from it
restore-keys: ${{ env.NX_CACHE_RESTORE_KEYS }}
- name: Build tarballs
run: yarn build:tarball
- name: Stores tarballs in cache
uses: actions/cache/save@v3
with:
path: ${{ github.workspace }}/packages/*/*.tgz
key: ${{ env.BUILD_CACHE_TARBALL_KEY }}

job_e2e_tests:
name: E2E ${{ matrix.label || matrix.test-application }} Test
Expand Down Expand Up @@ -877,6 +884,12 @@ jobs:
- test-application: 'standard-frontend-react'
build-command: 'test:build-ts3.8'
label: 'standard-frontend-react (TS 3.8)'
- test-application: 'create-next-app'
build-command: 'test:build-13'
label: 'create-next-app (next@13)'
- test-application: 'nextjs-app-dir'
build-command: 'test:build-13'
label: 'nextjs-app-dir (next@13)'

steps:
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ jest/transformers/*.js
# node tarballs
packages/*/sentry-*.tgz
.nxcache
# The Deno types are downloaded before building
packages/deno/lib.deno.d.ts

# logs
yarn-error.log
Expand Down
46 changes: 46 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,52 @@

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

## 7.76.0

### Important Changes

- **feat(core): Add cron monitor wrapper helper (#9395)**

This release adds `Sentry.withMonitor()`, a wrapping function that wraps a callback with a cron monitor that will automatically report completions and failures:

```ts
import * as Sentry from '@sentry/node';

// withMonitor() will send checkin when callback is started/finished
// works with async and sync callbacks.
const result = Sentry.withMonitor(
'dailyEmail',
() => {
// withCheckIn return value is same return value here
return sendEmail();
},
// Optional upsert options
{
schedule: {
type: 'crontab',
value: '0 * * * *',
},
// 🇨🇦🫡
timezone: 'Canada/Eastern',
},
);
```

### Other Changes

- chore(angular-ivy): Allow Angular 17 in peer dependencies (#9386)
- feat(nextjs): Instrument SSR page components (#9346)
- feat(nextjs): Trace errors in page component SSR (#9388)
- fix(nextjs): Instrument route handlers with `jsx` and `tsx` file extensions (#9362)
- fix(nextjs): Trace with performance disabled (#9389)
- fix(replay): Ensure `replay_id` is not added to DSC if session expired (#9359)
- fix(replay): Remove unused parts of pako from build (#9369)
- fix(serverless): Don't mark all errors as unhandled (#9368)
- fix(tracing-internal): Fix case when middleware contain array of routes with special chars as @ (#9375)
- meta(nextjs): Bump peer deps for Next.js 14 (#9390)

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

## 7.75.1

- feat(browser): Allow collecting of pageload profiles (#9317)
Expand Down
2 changes: 1 addition & 1 deletion packages/angular-ivy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

## Angular Version Compatibility

This SDK officially supports Angular 12 to 16 with Angular's new rendering engine, Ivy.
This SDK officially supports Angular 12 to 17 with Angular's new rendering engine, Ivy.

If you're using Angular 10, 11 or a newer Angular version with View Engine instead of Ivy, please use [`@sentry/angular`](https://github.com/getsentry/sentry-javascript/blob/develop/packages/angular/README.md).

Expand Down
6 changes: 3 additions & 3 deletions packages/angular-ivy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"access": "public"
},
"peerDependencies": {
"@angular/common": ">= 12.x <= 16.x",
"@angular/core": ">= 12.x <= 16.x",
"@angular/router": ">= 12.x <= 16.x",
"@angular/common": ">= 12.x <= 17.x",
"@angular/core": ">= 12.x <= 17.x",
"@angular/router": ">= 12.x <= 17.x",
"rxjs": "^6.5.5 || ^7.x"
},
"dependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/astro/src/index.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export {
captureEvent,
captureMessage,
captureCheckIn,
withMonitor,
configureScope,
createTransport,
extractTraceparentData,
Expand Down
1 change: 1 addition & 0 deletions packages/bun/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export {
trace,
withScope,
captureCheckIn,
withMonitor,
setMeasurement,
getActiveSpan,
startSpan,
Expand Down
46 changes: 45 additions & 1 deletion packages/core/src/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import type {
EventHint,
Extra,
Extras,
FinishedCheckIn,
MonitorConfig,
Primitive,
Severity,
SeverityLevel,
TransactionContext,
User,
} from '@sentry/types';
import { logger, uuid4 } from '@sentry/utils';
import { isThenable, logger, timestampInSeconds, uuid4 } from '@sentry/utils';

import type { Hub } from './hub';
import { getCurrentHub } from './hub';
Expand Down Expand Up @@ -210,6 +211,49 @@ export function captureCheckIn(checkIn: CheckIn, upsertMonitorConfig?: MonitorCo
return uuid4();
}

/**
* Wraps a callback with a cron monitor check in. The check in will be sent to Sentry when the callback finishes.
*
* @param monitorSlug The distinct slug of the monitor.
* @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want
* to create a monitor automatically when sending a check in.
*/
export function withMonitor<T>(
monitorSlug: CheckIn['monitorSlug'],
callback: () => T,
upsertMonitorConfig?: MonitorConfig,
): T {
const checkInId = captureCheckIn({ monitorSlug, status: 'in_progress' }, upsertMonitorConfig);
const now = timestampInSeconds();

function finishCheckIn(status: FinishedCheckIn['status']): void {
captureCheckIn({ monitorSlug, status, checkInId, duration: timestampInSeconds() - now });
}

let maybePromiseResult: T;
try {
maybePromiseResult = callback();
} catch (e) {
finishCheckIn('error');
throw e;
}

if (isThenable(maybePromiseResult)) {
Promise.resolve(maybePromiseResult).then(
() => {
finishCheckIn('ok');
},
() => {
finishCheckIn('error');
},
);
} else {
finishCheckIn('ok');
}

return maybePromiseResult;
}

/**
* Call `flush()` on the current client, if there is one. See {@link Client.flush}.
*
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export * from './tracing';
export {
addBreadcrumb,
captureCheckIn,
withMonitor,
captureException,
captureEvent,
captureMessage,
Expand Down
2 changes: 2 additions & 0 deletions packages/deno/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
build-types
build-test
lib.deno.d.ts
4 changes: 3 additions & 1 deletion packages/deno/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@
"lint:eslint": "eslint . --format stylish",
"lint:prettier": "prettier --check \"{src,test,scripts}/**/**.ts\"",
"install:deno": "node ./scripts/install-deno.mjs",
"test": "run-s deno-types install:deno test:types test:unit",
"pretest": "run-s deno-types test:build",
"test": "run-s install:deno test:types test:unit",
"test:build": "tsc -p tsconfig.test.types.json && rollup -c rollup.test.config.js",
"test:types": "deno check ./build/index.js",
"test:unit": "deno test --allow-read --allow-run",
"test:unit:update": "deno test --allow-read --allow-write --allow-run -- --update",
Expand Down
42 changes: 42 additions & 0 deletions packages/deno/rollup.test.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// @ts-check
import dts from 'rollup-plugin-dts';
import nodeResolve from '@rollup/plugin-node-resolve';
import sucrase from '@rollup/plugin-sucrase';
import { defineConfig } from 'rollup';

export default [
defineConfig({
input: ['test/build.ts'],
output: {
file: 'build-test/index.js',
sourcemap: true,
preserveModules: false,
strict: false,
freeze: false,
interop: 'auto',
format: 'esm',
banner: '/// <reference types="./index.d.ts" />',
},
plugins: [
nodeResolve({
extensions: ['.mjs', '.js', '.json', '.node', '.ts', '.tsx'],
}),
sucrase({ transforms: ['typescript'] }),
],
}),
defineConfig({
input: './build-test/build.d.ts',
output: [{ file: 'build-test/index.d.ts', format: 'es' }],
plugins: [
dts({ respectExternal: true }),
// The bundled types contain a declaration for the __DEBUG_BUILD__ global
// This can result in errors about duplicate global declarations so we strip it out!
{
name: 'strip-global',
renderChunk(code) {
return { code: code.replace(/declare global \{\s*const __DEBUG_BUILD__: boolean;\s*\}/g, '') };
},
},
],
}),
];
1 change: 1 addition & 0 deletions packages/deno/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export {
trace,
withScope,
captureCheckIn,
withMonitor,
setMeasurement,
getActiveSpan,
startSpan,
Expand Down
8 changes: 4 additions & 4 deletions packages/deno/test/__snapshots__/mod.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ snapshot[`captureException 1`] = `
filename: "app:///test/mod.test.ts",
function: "<anonymous>",
in_app: true,
lineno: 42,
lineno: 46,
post_context: [
"",
" await delay(200);",
" await assertSnapshot(t, ev);",
"});",
"",
"Deno.test('captureMessage', async t => {",
" let ev: Event | undefined;",
" let ev: sentryTypes.Event | undefined;",
],
pre_context: [
" ev = event;",
Expand All @@ -108,7 +108,7 @@ snapshot[`captureException 1`] = `
filename: "app:///test/mod.test.ts",
function: "something",
in_app: true,
lineno: 39,
lineno: 43,
post_context: [
" }",
"",
Expand All @@ -120,7 +120,7 @@ snapshot[`captureException 1`] = `
],
pre_context: [
"Deno.test('captureException', async t => {",
" let ev: Event | undefined;",
" let ev: sentryTypes.Event | undefined;",
" const [hub] = getTestClient(event => {",
" ev = event;",
" });",
Expand Down
4 changes: 4 additions & 0 deletions packages/deno/test/build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// We use this as the entry point to bundle Sentry dependencies that are used by the tests.
export * as sentryTypes from '@sentry/types';
export * as sentryUtils from '@sentry/utils';
export * as sentryCore from '@sentry/core';
16 changes: 10 additions & 6 deletions packages/deno/test/mod.test.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
import { assertEquals } from 'https://deno.land/[email protected]/assert/assert_equals.ts';
import { assertSnapshot } from 'https://deno.land/[email protected]/testing/snapshot.ts';

import { createStackParser, nodeStackLineParser } from '../../utils/build/esm/index.js';
import type { sentryTypes } from '../build-test/index.js';
import { sentryUtils } from '../build-test/index.js';
import { defaultIntegrations, DenoClient, Hub, Scope } from '../build/index.js';
import { getNormalizedEvent } from './normalize.ts';
import { makeTestTransport } from './transport.ts';

function getTestClient(callback: (event?: Event) => void, integrations: any[] = []): [Hub, DenoClient] {
function getTestClient(
callback: (event?: sentryTypes.Event) => void,
integrations: sentryTypes.Integration[] = [],
): [Hub, DenoClient] {
const client = new DenoClient({
dsn: 'https://[email protected]/5650507',
debug: true,
integrations: [...defaultIntegrations, ...integrations],
stackParser: createStackParser(nodeStackLineParser()),
stackParser: sentryUtils.createStackParser(sentryUtils.nodeStackLineParser()),
transport: makeTestTransport(envelope => {
callback(getNormalizedEvent(envelope));
}) as any,
}),
});

const scope = new Scope();
Expand All @@ -30,7 +34,7 @@ function delay(time: number): Promise<void> {
}

Deno.test('captureException', async t => {
let ev: Event | undefined;
let ev: sentryTypes.Event | undefined;
const [hub] = getTestClient(event => {
ev = event;
});
Expand All @@ -46,7 +50,7 @@ Deno.test('captureException', async t => {
});

Deno.test('captureMessage', async t => {
let ev: Event | undefined;
let ev: sentryTypes.Event | undefined;
const [hub] = getTestClient(event => {
ev = event;
});
Expand Down
Loading

0 comments on commit 13fe88a

Please sign in to comment.