Skip to content

Draft PR: Effect Integration for Sentry Node SDK #17432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -540,13 +540,15 @@ Work in this release was contributed by @0xbad0c0d3 and @alSergey. Thank you for
// server/plugins/sentry-cloudflare-setup.ts (filename does not matter)
import { sentryCloudflareNitroPlugin } from '@sentry/nuxt/module/plugins';

export default defineNitroPlugin(sentryCloudflareNitroPlugin((nitroApp: NitroApp) => {
// You can access nitroApp here if needed
return ({
dsn: 'https://dsn',
tracesSampleRate: 1.0,
})
}))
export default defineNitroPlugin(
sentryCloudflareNitroPlugin((nitroApp: NitroApp) => {
// You can access nitroApp here if needed
return {
dsn: 'https://dsn',
tracesSampleRate: 1.0,
};
}),
);
```

### Other Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ var _sentryModuleMetadataGlobal =
typeof window !== 'undefined'
? window
: typeof global !== 'undefined'
? global
: typeof self !== 'undefined'
? self
: {};
? global
: typeof self !== 'undefined'
? self
: {};

_sentryModuleMetadataGlobal._sentryModuleMetadata = _sentryModuleMetadataGlobal._sentryModuleMetadata || {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ var _sentryModuleMetadataGlobal =
typeof window !== 'undefined'
? window
: typeof global !== 'undefined'
? global
: typeof self !== 'undefined'
? self
: {};
? global
: typeof self !== 'undefined'
? self
: {};

_sentryModuleMetadataGlobal._sentryModuleMetadata = _sentryModuleMetadataGlobal._sentryModuleMetadata || {};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,15 @@ sentryTest('allows to ignore mutations via `ignoreMutations` option', async ({ g
const requests = await requestsPromise;

// All transform mutatinos are ignored and not captured
const transformMutations = requests.replayRecordingSnapshots.filter(
item =>
(item.data as mutationData)?.attributes?.some(
attr => attr.attributes['style'] && attr.attributes['class'] !== 'moved',
),
const transformMutations = requests.replayRecordingSnapshots.filter(item =>
(item.data as mutationData)?.attributes?.some(
attr => attr.attributes['style'] && attr.attributes['class'] !== 'moved',
),
);

// Should capture the final class mutation
const classMutations = requests.replayRecordingSnapshots.filter(
item => (item.data as mutationData)?.attributes?.some(attr => attr.attributes['class']),
const classMutations = requests.replayRecordingSnapshots.filter(item =>
(item.data as mutationData)?.attributes?.some(attr => attr.attributes['class']),
);

expect(transformMutations).toEqual([]);
Expand Down
11 changes: 4 additions & 7 deletions dev-packages/browser-integration-tests/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,10 @@ export const countEnvelopes = async (

page.on('request', requestHandler);

setTimeout(
() => {
page.off('request', requestHandler);
resolve(reqCount);
},
options?.timeout || 1000,
);
setTimeout(() => {
page.off('request', requestHandler);
resolve(reqCount);
}, options?.timeout || 1000);
});

if (options?.url) {
Expand Down
4 changes: 2 additions & 2 deletions dev-packages/cloudflare-integration-tests/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default defineConfig({
reporters: process.env.DEBUG
? ['default', { summary: false }]
: process.env.GITHUB_ACTIONS
? ['dot', 'github-actions']
: ['verbose'],
? ['dot', 'github-actions']
: ['verbose'],
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ body {
background-repeat: repeat;
height: 100%;
margin: 0;
font-family:
Rubik,
Avenir Next,
Helvetica Neue,
sans-serif;
font-family: Rubik, Avenir Next, Helvetica Neue, sans-serif;
font-size: 16px;
line-height: 24px;
color: var(--foreground-color);
Expand All @@ -47,9 +43,7 @@ body {
.box {
background-color: #fff;
border: 0;
box-shadow:
0 0 0 1px rgba(0, 0, 0, 0.08),
0 1px 4px rgba(0, 0, 0, 0.1);
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.1);
border-radius: 4px;
display: flex;
width: 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ body {
background-repeat: repeat;
height: 100%;
margin: 0;
font-family:
Rubik,
Avenir Next,
Helvetica Neue,
sans-serif;
font-family: Rubik, Avenir Next, Helvetica Neue, sans-serif;
font-size: 16px;
line-height: 24px;
color: var(--foreground-color);
Expand All @@ -47,9 +43,7 @@ body {
.box {
background-color: #fff;
border: 0;
box-shadow:
0 0 0 1px rgba(0, 0, 0, 0.08),
0 1px 4px rgba(0, 0, 0, 0.1);
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.1);
border-radius: 4px;
display: flex;
width: 100%;
Expand Down
19 changes: 3 additions & 16 deletions dev-packages/e2e-tests/test-applications/vue-3/src/assets/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,10 @@ body {
min-height: 100vh;
color: var(--color-text);
background: var(--color-background);
transition:
color 0.5s,
background-color 0.5s;
transition: color 0.5s, background-color 0.5s;
line-height: 1.6;
font-family:
Inter,
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Roboto,
Oxygen,
Ubuntu,
Cantarell,
'Fira Sans',
'Droid Sans',
'Helvetica Neue',
sans-serif;
font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Fira Sans',
'Droid Sans', 'Helvetica Neue', sans-serif;
font-size: 15px;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
Expand Down
4 changes: 2 additions & 2 deletions dev-packages/node-core-integration-tests/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default defineConfig({
reporters: process.env.DEBUG
? ['default', { summary: false }]
: process.env.GITHUB_ACTIONS
? ['dot', 'github-actions']
: ['verbose'],
? ['dot', 'github-actions']
: ['verbose'],
},
});
4 changes: 2 additions & 2 deletions dev-packages/node-integration-tests/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default defineConfig({
reporters: process.env.DEBUG
? ['default', { summary: false }]
: process.env.GITHUB_ACTIONS
? ['dot', 'github-actions']
: ['verbose'],
? ['dot', 'github-actions']
: ['verbose'],
},
});
2 changes: 1 addition & 1 deletion docs/changelog/v7.md
Original file line number Diff line number Diff line change
Expand Up @@ -1855,7 +1855,7 @@ the error.

```typescript
// root.tsx
import { captureRemixErrorBoundaryError } from "@sentry/remix";
import { captureRemixErrorBoundaryError } from '@sentry/remix';

export const ErrorBoundary: V2_ErrorBoundaryComponent = () => {
const error = useRouteError();
Expand Down
6 changes: 3 additions & 3 deletions docs/migration/feedback.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,16 @@ function attachTo(button: HTMLElement) {
},
onFormSubmitted: () => {
widget.removeFromDom();
}
},
});
widget.appendToDom();
widget.open();
};

button.addEventListener('click', handleClick);
return () => {
button.removeEventListener('click', handleClick)
}
button.removeEventListener('click', handleClick);
};
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/migration/v7-to-v8.md
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ import { Severity, SeverityLevel } from '@sentry/types';

const levelA = Severity.error;

const levelB: SeverityLevel = "error"
const levelB: SeverityLevel = 'error';
```

```js
Expand Down
5 changes: 1 addition & 4 deletions packages/angular/test/errorhandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ class CustomError extends Error {
}

class ErrorLikeShapedClass implements Partial<Error> {
constructor(
public name: string,
public message: string,
) {}
constructor(public name: string, public message: string) {}
}

function createErrorEvent(message: string, innerError: any): ErrorEvent {
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/integration/snippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ const buildCommonInitOptions = (options: SentryOptions): string => `dsn: ${
environment: ${options.environment ? JSON.stringify(options.environment) : 'import.meta.env.PUBLIC_VERCEL_ENV'},
release: ${options.release ? JSON.stringify(options.release) : 'import.meta.env.PUBLIC_VERCEL_GIT_COMMIT_SHA'},
tracesSampleRate: ${options.tracesSampleRate ?? 1.0},${
options.sampleRate ? `\n sampleRate: ${options.sampleRate},` : ''
}`;
options.sampleRate ? `\n sampleRate: ${options.sampleRate},` : ''
}`;

/**
* We don't include the `BrowserTracing` integration if `bundleSizeOptimizations.excludeTracing` is falsy.
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/test/server/middleware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('sentryMiddleware', () => {
} as any;
});
vi.spyOn(SentryNode, 'getActiveSpan').mockImplementation(getSpanMock);
vi.spyOn(SentryNode, 'getClient').mockImplementation(() => ({}) as Client);
vi.spyOn(SentryNode, 'getClient').mockImplementation(() => ({} as Client));
vi.spyOn(SentryNode, 'getTraceMetaTags').mockImplementation(
() => `
<meta name="sentry-trace" content="123">
Expand Down
4 changes: 2 additions & 2 deletions packages/browser-utils/src/metrics/elementTiming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ export const _onElementTiming = ({ entries }: { entries: PerformanceEntry[] }):
const [spanStartTime, spanStartTimeSource] = loadTime
? [msToSec(loadTime), 'load-time']
: renderTime
? [msToSec(renderTime), 'render-time']
: [timestampInSeconds(), 'entry-emission'];
? [msToSec(renderTime), 'render-time']
: [timestampInSeconds(), 'entry-emission'];

const duration =
paintType === 'image-paint'
Expand Down
5 changes: 1 addition & 4 deletions packages/browser/src/integrations/reportingobserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ interface ReportingObserverOptions {

/** This is experimental and the types are not included with TypeScript, sadly. */
interface ReportingObserverClass {
new (
handler: (reports: Report[]) => void,
options: { buffered?: boolean; types?: ReportTypes[] },
): {
new (handler: (reports: Report[]) => void, options: { buffered?: boolean; types?: ReportTypes[] }): {
observe: () => void;
};
}
Expand Down
4 changes: 2 additions & 2 deletions packages/browser/src/profiling/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ export function createProfilePayload(
const transactionStartMs = start_timestamp
? start_timestamp
: typeof event.start_timestamp === 'number'
? event.start_timestamp * 1000
: timestampInSeconds() * 1000;
? event.start_timestamp * 1000
: timestampInSeconds() * 1000;
const transactionEndMs = typeof event.timestamp === 'number' ? event.timestamp * 1000 : timestampInSeconds() * 1000;

const profile: Profile = {
Expand Down
8 changes: 4 additions & 4 deletions packages/cloudflare/src/opentelemetry/tracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ class SentryCloudflareTracer implements Tracer {
typeof options === 'function'
? options
: typeof context === 'function'
? context
: typeof fn === 'function'
? fn
: () => {}
? context
: typeof fn === 'function'
? fn
: () => {}
) as F;

// In OTEL the semantic matches `startSpanManual` because spans are not auto-ended
Expand Down
15 changes: 6 additions & 9 deletions packages/core/src/integrations/mcp-server/piiFiltering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,10 @@ export function filterMcpPiiFromSpanData(
return spanData as Record<string, SpanAttributeValue>;
}

return Object.entries(spanData).reduce(
(acc, [key, value]) => {
if (!isPiiAttribute(key)) {
acc[key] = value as SpanAttributeValue;
}
return acc;
},
{} as Record<string, SpanAttributeValue>,
);
return Object.entries(spanData).reduce((acc, [key, value]) => {
if (!isPiiAttribute(key)) {
acc[key] = value as SpanAttributeValue;
}
return acc;
}, {} as Record<string, SpanAttributeValue>);
}
4 changes: 2 additions & 2 deletions packages/core/src/integrations/zoderrors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ type SingleLevelZodIssue<T extends ZodIssue> = {
[P in keyof T]: T[P] extends string | number | undefined
? T[P]
: T[P] extends unknown[]
? string | undefined
: unknown;
? string | undefined
: unknown;
};

/**
Expand Down
11 changes: 4 additions & 7 deletions packages/core/src/logs/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,10 @@ export function _INTERNAL_captureLog(
body: message,
trace_id: traceContext?.trace_id,
severity_number: severityNumber ?? SEVERITY_TEXT_TO_SEVERITY_NUMBER[level],
attributes: Object.keys(attributes).reduce(
(acc, key) => {
acc[key] = logAttributeToSerializedLogAttribute(attributes[key]);
return acc;
},
{} as Record<string, SerializedLogAttributeValue>,
),
attributes: Object.keys(attributes).reduce((acc, key) => {
acc[key] = logAttributeToSerializedLogAttribute(attributes[key]);
return acc;
}, {} as Record<string, SerializedLogAttributeValue>),
};

captureSerializedLog(client, serializedLog);
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ export class Scope {
scopeToMerge instanceof Scope
? scopeToMerge.getScopeData()
: isPlainObject(scopeToMerge)
? (captureContext as ScopeContext)
: undefined;
? (captureContext as ScopeContext)
: undefined;

const { tags, extra, user, contexts, level, fingerprint = [], propagationContext } = scopeInstance || {};

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/tracing/trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ export function startInactiveSpan(options: StartSpanOptions): Span {
const wrapper = options.scope
? (callback: () => Span) => withScope(options.scope, callback)
: customParentSpan !== undefined
? (callback: () => Span) => withActiveSpan(customParentSpan, callback)
: (callback: () => Span) => callback();
? (callback: () => Span) => withActiveSpan(customParentSpan, callback)
: (callback: () => Span) => callback();

return wrapper(() => {
const scope = getCurrentScope();
Expand Down
Loading