Skip to content

Commit

Permalink
Merge pull request #9488 from getsentry/prepare-release/7.79.0
Browse files Browse the repository at this point in the history
meta: Update CHANGELOG for 7.79.0
  • Loading branch information
Lms24 authored Nov 8, 2023
2 parents c1514ba + 3b09ca9 commit 79b1618
Show file tree
Hide file tree
Showing 20 changed files with 76 additions and 92 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

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

## 7.79.0

- feat(tracing): Add span `origin` to trace context (#9472)
- fix(deno): Emit .mjs files (#9485)
- fix(nextjs): Flush servercomponent events for edge (#9487)

## 7.78.0

### Important Changes
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/tracing/span.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ export class Span implements SpanInterface {
status: this.status,
tags: Object.keys(this.tags).length > 0 ? this.tags : undefined,
trace_id: this.traceId,
origin: this.origin,
});
}

Expand Down
7 changes: 6 additions & 1 deletion packages/deno/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

## Links

- [SDK on Deno registry](https://deno.land/x/sentry)
- [Official SDK Docs](https://docs.sentry.io/quickstart/)
- [TypeDoc](http://getsentry.github.io/sentry-javascript/)

Expand All @@ -23,6 +24,10 @@ To use this SDK, call `Sentry.init(options)` as early as possible in the main en
hook into the environment. Note that you can turn off almost all side effects using the respective options.

```javascript
// Import from the Deno registry
import * as Sentry from "https://deno.land/x/sentry/index.mjs";

// or import from npm registry
import * as Sentry from 'npm:@sentry/deno';

Sentry.init({
Expand All @@ -31,7 +36,7 @@ Sentry.init({
});
```

To set context information or send manual events, use the exported functions of `@sentry/deno`. Note that these
To set context information or send manual events, use the exported functions of the Deno SDK. Note that these
functions will not perform any action before you have called `init()`:

```javascript
Expand Down
3 changes: 1 addition & 2 deletions packages/deno/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/deno",
"author": "Sentry",
"license": "MIT",
"main": "build/index.js",
"module": "build/index.js",
"types": "build/index.d.ts",
"publishConfig": {
Expand Down Expand Up @@ -51,7 +50,7 @@
"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:types": "deno check ./build/index.mjs",
"test:unit": "deno test --allow-read --allow-run",
"test:unit:update": "deno test --allow-read --allow-write --allow-run -- --update",
"yalc:publish": "ts-node ../../scripts/prepack.ts && yalc publish build --push"
Expand Down
2 changes: 1 addition & 1 deletion packages/deno/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default defineConfig({
input: ['src/index.ts'],
treeshake: 'smallest',
output: {
dir: 'build',
file: 'build/index.mjs',
sourcemap: true,
preserveModules: false,
strict: false,
Expand Down
2 changes: 1 addition & 1 deletion packages/deno/test/example.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Sentry from '../build/index.js';
import * as Sentry from '../build/index.mjs';

Sentry.init({
dsn: 'https://1234@some-domain.com/4505526893805568',
Expand Down
2 changes: 1 addition & 1 deletion packages/deno/test/mod.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { assertSnapshot } from 'https://deno.land/std@0.202.0/testing/snapshot.t

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 { defaultIntegrations, DenoClient, Hub, Scope } from '../build/index.mjs';
import { getNormalizedEvent } from './normalize.ts';
import { makeTestTransport } from './transport.ts';

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const dynamic = 'force-dynamic';

export const runtime = 'edge';

export default async function Page() {
throw new Error('Edge Server Component Error');
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { test, expect } from '@playwright/test';
import { waitForError } from '../event-proxy-server';

test('Should record exceptions for faulty edge server components', async ({ page }) => {
const errorEventPromise = waitForError('nextjs-13-app-dir', errorEvent => {
return errorEvent?.exception?.values?.[0]?.value === 'Edge Server Component Error';
});

await page.goto('/edge-server-components/error');

expect(await errorEventPromise).toBeDefined();
});
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => {
'http.status_code': 200,
},
trace_id: traceId,
origin: 'auto.http.otel.http',
},
}),
}),
Expand All @@ -93,6 +94,7 @@ test('Propagates trace for outgoing http requests', async ({ baseURL }) => {
'http.status_code': 200,
},
trace_id: traceId,
origin: 'auto.http.otel.http',
},
}),
}),
Expand Down Expand Up @@ -162,6 +164,7 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => {
'http.status_code': 200,
},
trace_id: traceId,
origin: 'auto.http.otel.http',
},
}),
}),
Expand All @@ -184,6 +187,7 @@ test('Propagates trace for outgoing fetch requests', async ({ baseURL }) => {
'http.status_code': 200,
},
trace_id: traceId,
origin: 'auto.http.otel.http',
},
}),
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ test('Sends an API route transaction', async ({ baseURL }) => {
'http.status_code': 200,
},
trace_id: expect.any(String),
origin: 'auto.http.otel.http',
},
}),

Expand Down
4 changes: 4 additions & 0 deletions packages/nextjs/src/common/wrapServerComponentWithSentry.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
addTracingExtensions,
captureException,
flush,
getCurrentHub,
runWithAsyncContext,
startTransaction,
Expand Down Expand Up @@ -81,6 +82,7 @@ export function wrapServerComponentWithSentry<F extends (...args: any[]) => any>
maybePromiseResult = originalFunction.apply(thisArg, args);
} catch (e) {
handleErrorCase(e);
void flush();
throw e;
}

Expand All @@ -94,12 +96,14 @@ export function wrapServerComponentWithSentry<F extends (...args: any[]) => any>
handleErrorCase(e);
},
);
void flush();

// It is very important that we return the original promise here, because Next.js attaches various properties
// to that promise and will throw if they are not on the returned value.
return maybePromiseResult;
} else {
transaction.finish();
void flush();
return maybePromiseResult;
}
});
Expand Down
1 change: 1 addition & 0 deletions packages/node-experimental/test/integration/scope.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ describe('Integration | Scope', () => {
span_id: spanId,
status: 'ok',
trace_id: traceId,
origin: 'manual',
},
}),
spans: [],
Expand Down
60 changes: 12 additions & 48 deletions packages/node-experimental/test/integration/transactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,18 @@ describe('Integration | Transactions', () => {
metadata: { requestPath: 'test-path' },
},
span => {
if (!span) {
return;
}

Sentry.addBreadcrumb({ message: 'test breadcrumb 2', timestamp: 123456 });

span.setAttributes({
'test.outer': 'test value',
});

const subSpan = Sentry.startInactiveSpan({ name: 'inner span 1' });
subSpan?.end();
subSpan.end();

Sentry.setTag('test.tag', 'test value');

Sentry.startSpan({ name: 'inner span 2' }, innerSpan => {
if (!innerSpan) {
return;
}

Sentry.addBreadcrumb({ message: 'test breadcrumb 3', timestamp: 123456 });

innerSpan.setAttributes({
Expand Down Expand Up @@ -97,6 +89,7 @@ describe('Integration | Transactions', () => {
span_id: expect.any(String),
status: 'ok',
trace_id: expect.any(String),
origin: 'auto.test',
},
},
environment: 'production',
Expand Down Expand Up @@ -189,26 +182,18 @@ describe('Integration | Transactions', () => {
Sentry.addBreadcrumb({ message: 'test breadcrumb 1', timestamp: 123456 });

Sentry.startSpan({ op: 'test op', name: 'test name', source: 'task', origin: 'auto.test' }, span => {
if (!span) {
return;
}

Sentry.addBreadcrumb({ message: 'test breadcrumb 2', timestamp: 123456 });

span.setAttributes({
'test.outer': 'test value',
});

const subSpan = Sentry.startInactiveSpan({ name: 'inner span 1' });
subSpan?.end();
subSpan.end();

Sentry.setTag('test.tag', 'test value');

Sentry.startSpan({ name: 'inner span 2' }, innerSpan => {
if (!innerSpan) {
return;
}

Sentry.addBreadcrumb({ message: 'test breadcrumb 3', timestamp: 123456 });

innerSpan.setAttributes({
Expand All @@ -218,26 +203,18 @@ describe('Integration | Transactions', () => {
});

Sentry.startSpan({ op: 'test op b', name: 'test name b' }, span => {
if (!span) {
return;
}

Sentry.addBreadcrumb({ message: 'test breadcrumb 2b', timestamp: 123456 });

span.setAttributes({
'test.outer': 'test value b',
});

const subSpan = Sentry.startInactiveSpan({ name: 'inner span 1b' });
subSpan?.end();
subSpan.end();

Sentry.setTag('test.tag', 'test value b');

Sentry.startSpan({ name: 'inner span 2b' }, innerSpan => {
if (!innerSpan) {
return;
}

Sentry.addBreadcrumb({ message: 'test breadcrumb 3b', timestamp: 123456 });

innerSpan.setAttributes({
Expand Down Expand Up @@ -268,6 +245,7 @@ describe('Integration | Transactions', () => {
span_id: expect.any(String),
status: 'ok',
trace_id: expect.any(String),
origin: 'auto.test',
},
}),
spans: [
Expand Down Expand Up @@ -309,6 +287,7 @@ describe('Integration | Transactions', () => {
span_id: expect.any(String),
status: 'ok',
trace_id: expect.any(String),
origin: 'manual',
},
}),
spans: [
Expand Down Expand Up @@ -362,19 +341,11 @@ describe('Integration | Transactions', () => {
context.with(
trace.setSpanContext(setPropagationContextOnContext(context.active(), propagationContext), spanContext),
() => {
Sentry.startSpan({ op: 'test op', name: 'test name', source: 'task', origin: 'auto.test' }, span => {
if (!span) {
return;
}

Sentry.startSpan({ op: 'test op', name: 'test name', source: 'task', origin: 'auto.test' }, () => {
const subSpan = Sentry.startInactiveSpan({ name: 'inner span 1' });
subSpan?.end();
subSpan.end();

Sentry.startSpan({ name: 'inner span 2' }, innerSpan => {
if (!innerSpan) {
return;
}
});
Sentry.startSpan({ name: 'inner span 2' }, () => {});
});
},
);
Expand All @@ -395,6 +366,7 @@ describe('Integration | Transactions', () => {
parent_span_id: parentSpanId,
status: 'ok',
trace_id: traceId,
origin: 'auto.test',
},
}),
// spans are circular (they have a reference to the transaction), which leads to jest choking on this
Expand Down Expand Up @@ -481,20 +453,12 @@ describe('Integration | Transactions', () => {
let innerSpan1Id: string | undefined;
let innerSpan2Id: string | undefined;

void Sentry.startSpan({ name: 'test name' }, async span => {
if (!span) {
return;
}

void Sentry.startSpan({ name: 'test name' }, async () => {
const subSpan = Sentry.startInactiveSpan({ name: 'inner span 1' });
innerSpan1Id = subSpan?.spanContext().spanId;
subSpan?.end();
subSpan.end();

Sentry.startSpan({ name: 'inner span 2' }, innerSpan => {
if (!innerSpan) {
return;
}

innerSpan2Id = innerSpan.spanContext().spanId;
});

Expand Down
2 changes: 2 additions & 0 deletions packages/opentelemetry/test/custom/transaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ describe('NodeExperimentalTransaction', () => {
trace: {
span_id: expect.any(String),
trace_id: expect.any(String),
origin: 'manual',
},
},
spans: [],
Expand Down Expand Up @@ -106,6 +107,7 @@ describe('NodeExperimentalTransaction', () => {
trace: {
span_id: expect.any(String),
trace_id: expect.any(String),
origin: 'manual',
},
},
spans: [],
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry/test/integration/scope.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ describe('Integration | Scope', () => {
span_id: spanId,
status: 'ok',
trace_id: traceId,
origin: 'manual',
},
}),

Expand Down
Loading

0 comments on commit 79b1618

Please sign in to comment.