Skip to content

Commit 5b717ae

Browse files
committed
fix stuff
1 parent 0c1c1c8 commit 5b717ae

File tree

4 files changed

+25
-16
lines changed

4 files changed

+25
-16
lines changed

docs/migration/v8-to-v9.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ Sentry.init({
150150
The following changes are unlikely to affect users of the SDK. They are listed here only for completion sake, and to alert users that may be relying on internal behavior.
151151

152152
- `client._prepareEvent()` now requires a currentScope & isolationScope to be passed as last arugments
153-
- `client._processEvent()` is now private (was protected)
154153

155154
### `@sentry/browser`
156155

packages/core/src/baseclient.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,12 @@ export abstract class BaseClient<O extends ClientOptions> implements Client<O> {
764764
* @param currentScope A scope containing event metadata.
765765
* @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.
766766
*/
767-
private _processEvent(event: Event, hint: EventHint, currentScope: Scope, isolationScope: Scope): PromiseLike<Event> {
767+
protected _processEvent(
768+
event: Event,
769+
hint: EventHint,
770+
currentScope: Scope,
771+
isolationScope: Scope,
772+
): PromiseLike<Event> {
768773
const options = this.getOptions();
769774
const { sampleRate } = options;
770775

packages/core/test/lib/serverruntimeclient.test.ts renamed to packages/core/test/lib/server-runtime-client.test.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Event, EventHint } from '../../src/types-hoist';
22

3-
import { createTransport } from '../../src';
3+
import { Scope, createTransport } from '../../src';
44
import type { ServerRuntimeClientOptions } from '../../src/server-runtime-client';
55
import { ServerRuntimeClient } from '../../src/server-runtime-client';
66

@@ -18,14 +18,17 @@ function getDefaultClientOptions(options: Partial<ServerRuntimeClientOptions> =
1818
describe('ServerRuntimeClient', () => {
1919
let client: ServerRuntimeClient;
2020

21+
const currentScope = new Scope();
22+
const isolationScope = new Scope();
23+
2124
describe('_prepareEvent', () => {
2225
test('adds platform to event', () => {
2326
const options = getDefaultClientOptions({ dsn: PUBLIC_DSN });
2427
const client = new ServerRuntimeClient({ ...options, platform: 'blargh' });
2528

2629
const event: Event = {};
2730
const hint: EventHint = {};
28-
(client as any)._prepareEvent(event, hint);
31+
client['_prepareEvent'](event, hint, currentScope, isolationScope);
2932

3033
expect(event.platform).toEqual('blargh');
3134
});
@@ -36,7 +39,7 @@ describe('ServerRuntimeClient', () => {
3639

3740
const event: Event = {};
3841
const hint: EventHint = {};
39-
(client as any)._prepareEvent(event, hint);
42+
client['_prepareEvent'](event, hint, currentScope, isolationScope);
4043

4144
expect(event.server_name).toEqual('server');
4245
});
@@ -47,7 +50,7 @@ describe('ServerRuntimeClient', () => {
4750

4851
const event: Event = {};
4952
const hint: EventHint = {};
50-
(client as any)._prepareEvent(event, hint);
53+
client['_prepareEvent'](event, hint, currentScope, isolationScope);
5154

5255
expect(event.contexts?.runtime).toEqual({
5356
name: 'edge',
@@ -60,7 +63,7 @@ describe('ServerRuntimeClient', () => {
6063

6164
const event: Event = { contexts: { runtime: { name: 'foo', version: '1.2.3' } } };
6265
const hint: EventHint = {};
63-
(client as any)._prepareEvent(event, hint);
66+
client['_prepareEvent'](event, hint, currentScope, isolationScope);
6467

6568
expect(event.contexts?.runtime).toEqual({ name: 'foo', version: '1.2.3' });
6669
expect(event.contexts?.runtime).not.toEqual({ name: 'edge' });

packages/node/test/sdk/client.test.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import * as os from 'os';
22
import { ProxyTracer } from '@opentelemetry/api';
33
import * as opentelemetryInstrumentationPackage from '@opentelemetry/instrumentation';
44
import type { Event, EventHint } from '@sentry/core';
5-
import { SDK_VERSION, getCurrentScope, getGlobalScope, getIsolationScope } from '@sentry/core';
6-
5+
import { SDK_VERSION, Scope, getCurrentScope, getGlobalScope, getIsolationScope } from '@sentry/core';
76
import { setOpenTelemetryContextAsyncContextStrategy } from '@sentry/opentelemetry';
87
import { NodeClient } from '../../src';
98
import { getDefaultNodeClientOptions } from '../helpers/getDefaultNodeClientOptions';
@@ -65,13 +64,16 @@ describe('NodeClient', () => {
6564
});
6665

6766
describe('_prepareEvent', () => {
67+
const currentScope = new Scope();
68+
const isolationScope = new Scope();
69+
6870
test('adds platform to event', () => {
6971
const options = getDefaultNodeClientOptions({});
7072
const client = new NodeClient(options);
7173

7274
const event: Event = {};
7375
const hint: EventHint = {};
74-
client['_prepareEvent'](event, hint);
76+
client['_prepareEvent'](event, hint, currentScope, isolationScope);
7577

7678
expect(event.platform).toEqual('node');
7779
});
@@ -82,7 +84,7 @@ describe('NodeClient', () => {
8284

8385
const event: Event = {};
8486
const hint: EventHint = {};
85-
client['_prepareEvent'](event, hint);
87+
client['_prepareEvent'](event, hint, currentScope, isolationScope);
8688

8789
expect(event.contexts?.runtime).toEqual({
8890
name: 'node',
@@ -96,7 +98,7 @@ describe('NodeClient', () => {
9698

9799
const event: Event = {};
98100
const hint: EventHint = {};
99-
client['_prepareEvent'](event, hint);
101+
client['_prepareEvent'](event, hint, currentScope, isolationScope);
100102

101103
expect(event.server_name).toEqual('foo');
102104
});
@@ -108,7 +110,7 @@ describe('NodeClient', () => {
108110

109111
const event: Event = {};
110112
const hint: EventHint = {};
111-
client['_prepareEvent'](event, hint);
113+
client['_prepareEvent'](event, hint, currentScope, isolationScope);
112114

113115
expect(event.server_name).toEqual('foo');
114116

@@ -121,7 +123,7 @@ describe('NodeClient', () => {
121123

122124
const event: Event = {};
123125
const hint: EventHint = {};
124-
client['_prepareEvent'](event, hint);
126+
client['_prepareEvent'](event, hint, currentScope, isolationScope);
125127

126128
expect(event.server_name).toEqual(os.hostname());
127129
});
@@ -132,7 +134,7 @@ describe('NodeClient', () => {
132134

133135
const event: Event = { contexts: { runtime: { name: 'foo', version: '1.2.3' } } };
134136
const hint: EventHint = {};
135-
client['_prepareEvent'](event, hint);
137+
client['_prepareEvent'](event, hint, currentScope, isolationScope);
136138

137139
expect(event.contexts?.runtime).toEqual({ name: 'foo', version: '1.2.3' });
138140
expect(event.contexts?.runtime).not.toEqual({ name: 'node', version: process.version });
@@ -144,7 +146,7 @@ describe('NodeClient', () => {
144146

145147
const event: Event = { server_name: 'foo' };
146148
const hint: EventHint = {};
147-
client['_prepareEvent'](event, hint);
149+
client['_prepareEvent'](event, hint, currentScope, isolationScope);
148150

149151
expect(event.server_name).toEqual('foo');
150152
expect(event.server_name).not.toEqual('bar');

0 commit comments

Comments
 (0)