Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into feat/yarn-v4
Browse files Browse the repository at this point in the history
  • Loading branch information
timfish committed Jun 30, 2024
2 parents 36a24f8 + e5e9b1b commit f25541a
Show file tree
Hide file tree
Showing 13 changed files with 490 additions and 480 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

## Unreleased

## 5.0.0-beta.0
## 5.1.0

- feat: Update from [v8.0.0](https://github.com/getsentry/sentry-javascript/releases/tag/8.0.0) to
[v8.9.2](https://github.com/getsentry/sentry-javascript/releases/tag/8.9.2) of JavaScript SDKs
- feat: Include trace origin in auto spans (#915)

## 5.0.0

This release updates the underlying Sentry JavaScript SDKs to v8 which includes a number of breaking changes, including
removal of APIs deprecated in the previous major version. The aim of these changes is to improve our performance
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,11 @@ Sentry.captureEvent({
],
});
```

## Contributors

Thanks to everyone who contributed to the Sentry Electron SDK!

<a href="https://github.com/getsentry/sentry-electron/graphs/contributors">
<img src="https://contributors-img.web.app/image?repo=getsentry/sentry-electron" />
</a>
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sentry/electron",
"description": "Official Sentry SDK for Electron",
"version": "5.0.0-beta.0",
"version": "5.1.0",
"main": "./index.js",
"module": "./esm/main/index.js",
"browser": "./esm/renderer/index.js",
Expand Down Expand Up @@ -44,18 +44,18 @@
"e2e": "node scripts/start.mjs e2e"
},
"dependencies": {
"@sentry/browser": "8.0.0-beta.5",
"@sentry/core": "8.0.0-beta.5",
"@sentry/node": "8.0.0-beta.5",
"@sentry/types": "8.0.0-beta.5",
"@sentry/utils": "8.0.0-beta.5",
"@sentry/browser": "8.12.0",
"@sentry/core": "8.12.0",
"@sentry/node": "8.12.0",
"@sentry/types": "8.12.0",
"@sentry/utils": "8.12.0",
"deepmerge": "4.3.1"
},
"devDependencies": {
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^11.1.6",
"@sentry-internal/eslint-config-sdk": "8.0.0-beta.5",
"@sentry-internal/typescript": "8.0.0-beta.5",
"@sentry-internal/eslint-config-sdk": "8.12.0",
"@sentry-internal/typescript": "8.12.0",
"@types/busboy": "^0.2.3",
"@types/form-data": "^2.5.0",
"@types/koa": "^2.0.52",
Expand Down
51 changes: 31 additions & 20 deletions scripts/check-exports.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,37 @@ export default async function () {
const nodeExports = Object.keys(node);
const mainExports = Object.keys(main);

const ignoredBrowser = [
'SDK_VERSION',
'WINDOW',
'Integrations',
'close',
'flush',
'defaultStackLineParsers',
// These wont ever be used
'geckoStackLineParser',
'opera10StackLineParser',
'opera11StackLineParser',
'winjsStackLineParser',
// If you use the browser transports, just use the browser SDK
'makeBrowserOfflineTransport',
'makeFetchTransport',
'makeMultiplexedTransport',
'lazyLoadIntegration',
];

const ignoredNode = ['SDK_VERSION', 'makeNodeTransport', 'getSentryRelease'];
const ignoredBrowser = [
'SDK_VERSION',
'WINDOW',
'Integrations',
'close',
'flush',
'defaultStackLineParsers',
// These wont ever be used
'geckoStackLineParser',
'opera10StackLineParser',
'opera11StackLineParser',
'winjsStackLineParser',
// If you use the browser transports, just use the browser SDK
'makeBrowserOfflineTransport',
'makeFetchTransport',
'makeMultiplexedTransport',
'lazyLoadIntegration',
// deprecated
'captureUserFeedback',
];

const ignoredNode = [
'SDK_VERSION',
'makeNodeTransport',
'getSentryRelease',
// There's no way to use this in the main process
'preloadOpenTelemetry',
// We don't include these by default in the Electron SDK
'getDefaultIntegrationsWithoutPerformance',
'initWithoutDefaultIntegrations',
];

const missingRenderer = browserExports.filter(
(key) => !rendererExports.includes(key) && !ignoredBrowser.includes(key),
Expand Down
9 changes: 9 additions & 0 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export {
captureConsoleIntegration,
captureEvent,
captureException,
captureFeedback,
captureMessage,
captureSession,
close,
Expand All @@ -47,6 +48,7 @@ export {
fastifyIntegration,
flush,
functionToStringIntegration,
generateInstrumentOnce,
getActiveSpan,
getAutoPerformanceIntegrations,
getClient,
Expand All @@ -65,6 +67,7 @@ export {
initOpenTelemetry,
isInitialized,
koaIntegration,
lastEventId,
linkedErrorsIntegration,
localVariablesIntegration,
metrics,
Expand All @@ -81,9 +84,11 @@ export {
parameterize,
postgresIntegration,
prismaIntegration,
redisIntegration,
requestDataIntegration,
rewriteFramesIntegration,
Scope,
SentryContextManager,
SEMANTIC_ATTRIBUTE_SENTRY_OP,
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE,
Expand All @@ -105,18 +110,22 @@ export {
setupKoaErrorHandler,
setupNestErrorHandler,
setUser,
spanToBaggageHeader,
spanToJSON,
spanToTraceHeader,
spotlightIntegration,
startInactiveSpan,
startNewTrace,
startSession,
startSpan,
startSpanManual,
trpcMiddleware,
validateOpenTelemetrySetup,
withActiveSpan,
withIsolationScope,
withMonitor,
withScope,
zodErrorsIntegration,
} from '@sentry/node';

export type { NodeOptions } from '@sentry/node';
Expand Down
4 changes: 2 additions & 2 deletions src/main/integrations/electron-minidump.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ export const electronMinidumpIntegration = defineIntegration(() => {

// Update the extra parameters in the main process
const mainParams = getNativeUploaderExtraParams(event);
for (const key of Object.keys(mainParams)) {
crashReporter.addExtraParameter(key, mainParams[key]);
for (const [key, value] of Object.entries(mainParams)) {
crashReporter.addExtraParameter(key, value);
}
})
.catch((error) => logger.error(error));
Expand Down
3 changes: 3 additions & 0 deletions src/main/integrations/net-breadcrumbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
getDynamicSamplingContextFromClient,
getDynamicSamplingContextFromSpan,
getIsolationScope,
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
SentryNonRecordingSpan,
setHttpStatus,
spanToTraceHeader,
Expand Down Expand Up @@ -178,6 +179,8 @@ function createWrappedRequestFactory(
})
: new SentryNonRecordingSpan();

span.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto.http.electron.net');

if (shouldAttachTraceData(method, url)) {
const { traceId, spanId, sampled, dsc } = {
...getIsolationScope().getPropagationContext(),
Expand Down
14 changes: 8 additions & 6 deletions src/main/transports/electron-net.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ export function createElectronNetRequestExecutor(

const req = net.request(getRequestOptions(url));

for (const header of Object.keys(headers)) {
req.setHeader(header, headers[header]);
for (const [header, value] of Object.entries(headers)) {
req.setHeader(header, value);
}

req.on('response', (res) => {
Expand All @@ -93,13 +93,15 @@ export function createElectronNetRequestExecutor(

// "Key-value pairs of header names and values. Header names are lower-cased."
// https://nodejs.org/api/http.html#http_message_headers
const retryAfterHeader = res.headers['retry-after'] ?? undefined;
const rateLimitsHeader = res.headers['x-sentry-rate-limits'] ?? undefined;
const retryAfterHeader = res.headers['retry-after'] ?? null;
const rateLimitsHeader = res.headers['x-sentry-rate-limits'] ?? null;

resolve({
headers: dropUndefinedKeys({
'retry-after': Array.isArray(retryAfterHeader) ? retryAfterHeader[0] : retryAfterHeader,
'x-sentry-rate-limits': Array.isArray(rateLimitsHeader) ? rateLimitsHeader[0] : rateLimitsHeader,
'retry-after': Array.isArray(retryAfterHeader) ? retryAfterHeader[0] || null : retryAfterHeader,
'x-sentry-rate-limits': Array.isArray(rateLimitsHeader)
? rateLimitsHeader[0] || null
: rateLimitsHeader,
}),
});
});
Expand Down
8 changes: 7 additions & 1 deletion src/renderer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ export {
captureConsoleIntegration,
captureEvent,
captureException,
captureFeedback,
captureMessage,
captureSession,
captureUserFeedback,
chromeStackLineParser,
contextLinesIntegration,
continueTrace,
Expand All @@ -46,6 +46,7 @@ export {
extraErrorDataIntegration,
feedbackAsyncIntegration,
feedbackIntegration,
feedbackSyncIntegration,
forceLoad,
functionToStringIntegration,
getActiveSpan,
Expand All @@ -66,6 +67,7 @@ export {
inboundFiltersIntegration,
instrumentOutgoingRequests,
isInitialized,
lastEventId,
linkedErrorsIntegration,
moduleMetadataIntegration,
onLoad,
Expand All @@ -92,17 +94,21 @@ export {
setTags,
setUser,
showReportDialog,
spanToBaggageHeader,
spanToJSON,
spanToTraceHeader,
startBrowserTracingNavigationSpan,
startBrowserTracingPageLoadSpan,
startInactiveSpan,
startNewTrace,
startSession,
startSpan,
startSpanManual,
thirdPartyErrorFilterIntegration,
withActiveSpan,
withIsolationScope,
withScope,
zodErrorsIntegration,
} from '@sentry/browser';

export type { BrowserOptions, ReportDialogOptions } from '@sentry/browser';
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ interface ElectronRendererOptions extends BrowserOptions {
export function init<O extends ElectronRendererOptions>(
options: ElectronRendererOptions & O = {} as ElectronRendererOptions & O,
// This parameter name ensures that TypeScript error messages contain a hint for fixing SDK version mismatches
originalInit: (if_you_get_a_typescript_error_ensure_sdks_use_version_v8_0_0_beta_5: O) => void = browserInit,
originalInit: (if_you_get_a_typescript_error_ensure_sdks_use_version_v8_12_0: O) => void = browserInit,
): void {
// Ensure the browser SDK is only init'ed once.
if (window?.__SENTRY__RENDERER_INIT__) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
{
"op": "http.client",
"trace_id": "{{id}}",
"origin": "auto.http.electron.net",
"parent_span_id": "{{id}}",
"span_id": "{{id}}",
"start_timestamp": 0,
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/versions.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["15.5.7","16.2.8","17.4.11","18.3.15","19.1.9","20.3.12","21.4.4","22.3.27","23.3.13","24.8.8","25.9.8","26.6.10","27.3.11","28.3.1","29.3.0","30.0.0"]
["15.5.7","16.2.8","17.4.11","18.3.15","19.1.9","20.3.12","21.4.4","22.3.27","23.3.13","24.8.8","25.9.8","26.6.10","27.3.11","28.3.3","29.4.2","30.1.2","31.1.0"]
Loading

0 comments on commit f25541a

Please sign in to comment.