Skip to content

Commit

Permalink
Merge pull request #11976 from getsentry/prepare-release/8.0.0-rc.3
Browse files Browse the repository at this point in the history
  • Loading branch information
lforst authored May 10, 2024
2 parents e987ed3 + 6870373 commit 7a8fe99
Show file tree
Hide file tree
Showing 29 changed files with 500 additions and 356 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@

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

## 8.0.0-rc.3

### Important Changes

- **feat(bun): Add Bun Global Unhandled Handlers (#11960)**

The Bun SDK will now capture global unhandled errors.

### Other Changes

- feat(node): Log process and thread info on initialisation (#11972)
- fix(aws-serverless): Include ESM artifacts in package (#11973)
- fix(browser): Only start `http.client` spans if there is an active parent span (#11974)
- fix(feedback): Improve CSS theme variable names and layout (#11964)
- fix(node): Ensure `execArgv` are not sent to worker threads (#11963)
- ref(feedback): Simplify feedback function params (#11957)

## 8.0.0-rc.2

### Important Changes
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const Sentry = require('@sentry/node');
const { loggingTransport } = require('@sentry-internal/node-integration-tests');

Sentry.init({
dsn: 'https://[email protected]/1337',
includeLocalVariables: true,
transport: loggingTransport,
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/* eslint-disable no-unused-vars */
process.on('uncaughtException', () => {
// do nothing - this will prevent the Error below from closing this process
});

class Some {
two(name) {
throw new Error('Enough!');
}
}

function one(name) {
const arr = [1, '2', null];
const obj = {
name,
num: 5,
};
const bool = false;
const num = 0;
const str = '';
const something = undefined;
const somethingElse = null;

const ty = new Some();

ty.two(name);
}

setTimeout(() => {
one('some name');
}, 1000);
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ conditionalTest({ min: 18 })('LocalVariables integration', () => {
.start(done);
});

test('Should include local variables when instrumenting via --require', done => {
const requirePath = path.resolve(__dirname, 'local-variables-instrument.js');

createRunner(__dirname, 'local-variables-no-sentry.js')
.withFlags(`--require=${requirePath}`)
.ignore('session')
.expect({ event: EXPECTED_LOCAL_VARIABLES_EVENT })
.start(done);
});

test('Should include local variables with ESM', done => {
createRunner(__dirname, 'local-variables-caught.mjs')
.ignore('session')
Expand Down
1 change: 1 addition & 0 deletions packages/aws-serverless/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"files": [
"cjs",
"esm",
"types",
"types-ts3.8",
"import-hook.mjs",
Expand Down
37 changes: 21 additions & 16 deletions packages/browser/src/tracing/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
SEMANTIC_ATTRIBUTE_SENTRY_OP,
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN,
SentryNonRecordingSpan,
getActiveSpan,
getClient,
getCurrentScope,
getDynamicSamplingContextFromClient,
Expand Down Expand Up @@ -324,20 +325,23 @@ export function xhrCallback(
const fullUrl = getFullURL(sentryXhrData.url);
const host = fullUrl ? parseUrl(fullUrl).host : undefined;

const span = shouldCreateSpanResult
? startInactiveSpan({
name: `${sentryXhrData.method} ${sentryXhrData.url}`,
attributes: {
type: 'xhr',
'http.method': sentryXhrData.method,
'http.url': fullUrl,
url: sentryXhrData.url,
'server.address': host,
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.browser',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.client',
},
})
: new SentryNonRecordingSpan();
const hasParent = !!getActiveSpan();

const span =
shouldCreateSpanResult && hasParent
? startInactiveSpan({
name: `${sentryXhrData.method} ${sentryXhrData.url}`,
attributes: {
type: 'xhr',
'http.method': sentryXhrData.method,
'http.url': fullUrl,
url: sentryXhrData.url,
'server.address': host,
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.http.browser',
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.client',
},
})
: new SentryNonRecordingSpan();

xhr.__sentry_xhr_span_id__ = span.spanContext().spanId;
spans[xhr.__sentry_xhr_span_id__] = span;
Expand All @@ -348,9 +352,10 @@ export function xhrCallback(
addTracingHeadersToXhrRequest(
xhr,
client,
// If performance is disabled (TWP), we do not want to use the span as base for the trace headers,
// If performance is disabled (TWP) or there's no active root span (pageload/navigation/interaction),
// we do not want to use the span as base for the trace headers,
// which means that the headers will be generated from the scope and the sampling decision is deferred
hasTracingEnabled() ? span : undefined,
hasTracingEnabled() && hasParent ? span : undefined,
);
}

Expand Down
8 changes: 5 additions & 3 deletions packages/bun/src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
modulesIntegration,
nativeNodeFetchIntegration,
nodeContextIntegration,
onUncaughtExceptionIntegration,
onUnhandledRejectionIntegration,
} from '@sentry/node';
import type { Integration, Options } from '@sentry/types';

Expand All @@ -33,9 +35,9 @@ export function getDefaultIntegrations(_options: Options): Integration[] {
consoleIntegration(),
httpIntegration(),
nativeNodeFetchIntegration(),
// Global Handlers # TODO (waiting for https://github.com/oven-sh/bun/issues/5091)
// new NodeIntegrations.OnUncaughtException(),
// new NodeIntegrations.OnUnhandledRejection(),
// Global Handlers
onUncaughtExceptionIntegration(),
onUnhandledRejectionIntegration(),
// Event Info
contextLinesIntegration(),
nodeContextIntegration(),
Expand Down
38 changes: 21 additions & 17 deletions packages/core/src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from './tracing';
import { SentryNonRecordingSpan } from './tracing/sentryNonRecordingSpan';
import { hasTracingEnabled } from './utils/hasTracingEnabled';
import { spanToTraceHeader } from './utils/spanUtils';
import { getActiveSpan, spanToTraceHeader } from './utils/spanUtils';

type PolymorphicRequestHeaders =
| Record<string, string | undefined>
Expand Down Expand Up @@ -70,20 +70,23 @@ export function instrumentFetchRequest(
const fullUrl = getFullURL(url);
const host = fullUrl ? parseUrl(fullUrl).host : undefined;

const span = shouldCreateSpanResult
? startInactiveSpan({
name: `${method} ${url}`,
attributes: {
url,
type: 'fetch',
'http.method': method,
'http.url': fullUrl,
'server.address': host,
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: spanOrigin,
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.client',
},
})
: new SentryNonRecordingSpan();
const hasParent = !!getActiveSpan();

const span =
shouldCreateSpanResult && hasParent
? startInactiveSpan({
name: `${method} ${url}`,
attributes: {
url,
type: 'fetch',
'http.method': method,
'http.url': fullUrl,
'server.address': host,
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: spanOrigin,
[SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.client',
},
})
: new SentryNonRecordingSpan();

handlerData.fetchData.__span = span.spanContext().spanId;
spans[span.spanContext().spanId] = span;
Expand All @@ -102,9 +105,10 @@ export function instrumentFetchRequest(
client,
scope,
options,
// If performance is disabled (TWP), we do not want to use the span as base for the trace headers,
// If performance is disabled (TWP) or there's no active root span (pageload/navigation/interaction),
// we do not want to use the span as base for the trace headers,
// which means that the headers will be generated from the scope and the sampling decision is deferred
hasTracingEnabled() ? span : undefined,
hasTracingEnabled() && hasParent ? span : undefined,
);
}

Expand Down
7 changes: 5 additions & 2 deletions packages/feedback/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ export const WINDOW = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;
export const DOCUMENT = WINDOW.document;
export const NAVIGATOR = WINDOW.navigator;

export const ACTOR_LABEL = 'Report a Bug';
export const TRIGGER_LABEL = 'Report a Bug';
export const CANCEL_BUTTON_LABEL = 'Cancel';
export const SUBMIT_BUTTON_LABEL = 'Send Bug Report';
export const CONFIRM_BUTTON_LABEL = 'Confirm';
export const FORM_TITLE = 'Report a Bug';
export const EMAIL_PLACEHOLDER = '[email protected]';
export const EMAIL_LABEL = 'Email';
Expand All @@ -20,7 +21,9 @@ export const MESSAGE_LABEL = 'Description';
export const NAME_PLACEHOLDER = 'Your Name';
export const NAME_LABEL = 'Name';
export const SUCCESS_MESSAGE_TEXT = 'Thank you for your report!';
export const IS_REQUIRED_TEXT = '(required)';
export const IS_REQUIRED_LABEL = '(required)';
export const ADD_SCREENSHOT_LABEL = 'Add a screenshot';
export const REMOVE_SCREENSHOT_LABEL = 'Remove screenshot';

export const FEEDBACK_WIDGET_SOURCE = 'widget';
export const FEEDBACK_API_SOURCE = 'api';
Expand Down
73 changes: 37 additions & 36 deletions packages/feedback/src/constants/theme.ts
Original file line number Diff line number Diff line change
@@ -1,57 +1,58 @@
const LIGHT_BACKGROUND = '#ffffff';
const INHERIT = 'inherit';
const SUBMIT_COLOR = 'rgba(108, 95, 199, 1)';
const PURPLE = 'rgba(88, 74, 192, 1)';
const PURPLE_HOVER = 'rgba(108, 95, 199, 1)';

export const LIGHT_THEME = {
fontFamily: "system-ui, 'Helvetica Neue', Arial, sans-serif",
fontSize: '14px',

foreground: '#2b2233',
background: LIGHT_BACKGROUND,
success: '#268d75',
error: '#df3338',

zIndex: 100000,
successForeground: '#268d75',
errorForeground: '#df3338',
background: '#ffffff',
border: '1.5px solid rgba(41, 35, 47, 0.13)',
boxShadow: '0px 4px 24px 0px rgba(43, 34, 51, 0.12)',

backgroundHover: '#f6f6f7',
borderRadius: '25px',

formBorderRadius: '20px',
formContentBorderRadius: '6px',

submitForeground: LIGHT_BACKGROUND,
submitBackground: 'rgba(88, 74, 192, 1)',
submitForegroundHover: LIGHT_BACKGROUND,
submitBackgroundHover: SUBMIT_COLOR,
submitBorder: SUBMIT_COLOR,
inputForeground: INHERIT,
inputBackground: INHERIT,
inputBackgroundHover: INHERIT,
inputBackgroundFocus: INHERIT,
inputBorder: 'var(--border)',
inputBorderRadius: '6px',
inputOutlineFocus: PURPLE_HOVER,

buttonForeground: INHERIT,
buttonForegroundHover: INHERIT,
buttonBackground: 'var(--background)',
buttonBackgroundHover: '#f6f6f7',
buttonBorder: 'var(--border)',
buttonOutlineFocus: 'var(--input-outline-focus)',

submitForeground: '#ffffff',
submitForegroundHover: '#ffffff',
submitBackground: PURPLE,
submitBackgroundHover: PURPLE_HOVER,
submitBorder: PURPLE_HOVER,
submitBorderRadius: 'var(--button-border-radius)',
submitOutlineFocus: '#29232f',

cancelForeground: 'var(--foreground)',
cancelBackground: 'transparent',
cancelForegroundHover: 'var(--foreground)',
cancelBackgroundHover: 'var(--background-hover)',
cancelBorder: 'var(--border)',
cancelOutlineFocus: 'var(--input-outline-focus)',
triggerBackground: 'var(--background)',
triggerBackgroundHover: 'var(--button-background-hover)',
triggerBorderRadius: '1.7em/50%',

inputBackground: INHERIT,
inputForeground: INHERIT,
inputBorder: 'var(--border)',
inputOutlineFocus: SUBMIT_COLOR,
dialogBackground: 'var(--background)',
dialogBorderRadius: '20px',
};

export const DEFAULT_THEME = {
light: LIGHT_THEME,
dark: {
...LIGHT_THEME,

background: '#29232f',
backgroundHover: '#352f3b',
foreground: '#ebe6ef',
border: '1.5px solid rgba(235, 230, 239, 0.15)',
successForeground: '#2da98c',
errorForeground: '#f55459',
background: '#29232f',
border: '1.5px solid rgba(235, 230, 239, 0.5)',
boxShadow: '0px 4px 24px 0px rgba(43, 34, 51, 0.12)',

success: '#2da98c',
error: '#f55459',
buttonBackgroundHover: '#352f3b',
},
};
15 changes: 8 additions & 7 deletions packages/feedback/src/core/components/Actor.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function createActorStyles(): HTMLStyleElement {
.widget__actor {
position: fixed;
z-index: var(--z-index);
margin: 0;
margin: var(--page-margin);
inset: var(--actor-inset);
display: flex;
Expand All @@ -20,14 +20,15 @@ export function createActorStyles(): HTMLStyleElement {
font-family: inherit;
font-size: var(--font-size);
font-weight: 600;
line-height: 16px;
line-height: 1.14em;
text-decoration: none;
background-color: var(--background);
border-radius: var(--border-radius);
background-color: var(--trigger-background);
border-radius: var(--trigger-border-radius);
border: var(--border);
box-shadow: var(--box-shadow);
color: var(--foreground);
fill: var(--foreground);
cursor: pointer;
opacity: 1;
transition: transform 0.2s ease-in-out;
Expand All @@ -41,12 +42,12 @@ export function createActorStyles(): HTMLStyleElement {
}
.widget__actor:hover {
background-color: var(--background-hover);
background-color: var(--trigger-background-hover);
}
.widget__actor svg {
width: 16px;
height: 16px;
width: 1.14em;
height: 1.14em;
}
@media (max-width: 600px) {
Expand Down
Loading

0 comments on commit 7a8fe99

Please sign in to comment.