Skip to content
Merged
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
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [18, 20, 22, 24]
node: [18, 20, 22, 24, 26]
steps:
- name: Check out base commit (${{ github.event.pull_request.base.sha }})
uses: actions/checkout@v6
Expand Down Expand Up @@ -810,7 +810,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [18, 20, 22, 24]
node: [18, 20, 22, 24, 26]
typescript:
- false
include:
Expand Down Expand Up @@ -851,7 +851,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [18, 20, 22, 24]
node: [18, 20, 22, 24, 26]
typescript:
- false
include:
Expand Down Expand Up @@ -939,7 +939,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [18, 20, 22, 24]
node: [18, 20, 22, 24, 26]
steps:
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
uses: actions/checkout@v6
Expand Down
3 changes: 2 additions & 1 deletion dev-packages/node-core-integration-tests/utils/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,8 @@ export function createRunner(...paths: string[]) {

if (process.env.DEBUG) log('stderr line', output);

if (ensureNoErrorOutput) {
// Ignore deprecation warnings for this purpose
if (ensureNoErrorOutput && !`${output}`.includes('DeprecationWarning:')) {
complete(new Error(`Expected no error output but got: '${output}'`));
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe('Console Integration', () => {

createEsmAndCjsTests(__dirname, 'scenario.mjs', 'instrument.mjs', (createRunner, test) => {
test('filters console messages', async () => {
await createRunner()
const runner = createRunner()
.expect({
event: {
exception: {
Expand All @@ -28,8 +28,17 @@ describe('Console Integration', () => {
],
},
})
.start()
.completed();
.start();

await runner.completed();

expect(runner.getLogs()).toContainEqual('hello');
expect(runner.getLogs()).toContainEqual('baz');
expect(runner.getLogs()).not.toContainEqual('foo');
expect(runner.getLogs()).not.toContainEqual('foo2');

// Ensure deprecation warnigns are not included
expect(runner.getLogs()).not.toContainEqual(expect.stringMatching('DeprecationWarning'));
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"pg": "8.16.0",
"pg-native": "3.5.0"
"pg": "8.20.0",
"pg-native": "3.7.0"
}
}
101 changes: 51 additions & 50 deletions dev-packages/node-integration-tests/suites/tracing/postgres/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { describe, expect, test } from 'vitest';
import { createRunner } from '../../../utils/runner';
import { conditionalTest } from '../../../utils';

describe('postgres auto instrumentation', () => {
test('should auto-instrument `pg` package', { timeout: 90_000 }, async () => {
Expand Down Expand Up @@ -49,7 +50,6 @@ describe('postgres auto instrumentation', () => {
await createRunner(__dirname, 'scenario.js')
.withDockerCompose({
workingDirectory: [__dirname],
setupCommand: 'yarn',
})
.expect({ transaction: EXPECTED_TRANSACTION })
.start()
Expand All @@ -60,7 +60,6 @@ describe('postgres auto instrumentation', () => {
await createRunner(__dirname, 'scenario-ignoreConnect.js')
.withDockerCompose({
workingDirectory: [__dirname],
setupCommand: 'yarn',
})
.expect({
transaction: txn => {
Expand Down Expand Up @@ -103,57 +102,59 @@ describe('postgres auto instrumentation', () => {
.completed();
});

test('should auto-instrument `pg-native` package', { timeout: 90_000 }, async () => {
const EXPECTED_TRANSACTION = {
transaction: 'Test Transaction',
spans: expect.arrayContaining([
expect.objectContaining({
data: expect.objectContaining({
'db.system': 'postgresql',
'db.name': 'tests',
'sentry.origin': 'manual',
'sentry.op': 'db',
conditionalTest({ max: 25 })('pg-native', () => {
test('should auto-instrument `pg-native` package', { timeout: 90_000 }, async () => {
const EXPECTED_TRANSACTION = {
transaction: 'Test Transaction',
spans: expect.arrayContaining([
expect.objectContaining({
data: expect.objectContaining({
'db.system': 'postgresql',
'db.name': 'tests',
'sentry.origin': 'manual',
'sentry.op': 'db',
}),
description: 'pg.connect',
op: 'db',
status: 'ok',
}),
description: 'pg.connect',
op: 'db',
status: 'ok',
}),
expect.objectContaining({
data: expect.objectContaining({
'db.system': 'postgresql',
'db.name': 'tests',
'db.statement': 'INSERT INTO "NativeUser" ("email", "name") VALUES ($1, $2)',
'sentry.origin': 'auto.db.otel.postgres',
'sentry.op': 'db',
expect.objectContaining({
data: expect.objectContaining({
'db.system': 'postgresql',
'db.name': 'tests',
'db.statement': 'INSERT INTO "NativeUser" ("email", "name") VALUES ($1, $2)',
'sentry.origin': 'auto.db.otel.postgres',
'sentry.op': 'db',
}),
description: 'INSERT INTO "NativeUser" ("email", "name") VALUES ($1, $2)',
op: 'db',
status: 'ok',
origin: 'auto.db.otel.postgres',
}),
description: 'INSERT INTO "NativeUser" ("email", "name") VALUES ($1, $2)',
op: 'db',
status: 'ok',
origin: 'auto.db.otel.postgres',
}),
expect.objectContaining({
data: expect.objectContaining({
'db.system': 'postgresql',
'db.name': 'tests',
'db.statement': 'SELECT * FROM "NativeUser"',
'sentry.origin': 'auto.db.otel.postgres',
'sentry.op': 'db',
expect.objectContaining({
data: expect.objectContaining({
'db.system': 'postgresql',
'db.name': 'tests',
'db.statement': 'SELECT * FROM "NativeUser"',
'sentry.origin': 'auto.db.otel.postgres',
'sentry.op': 'db',
}),
description: 'SELECT * FROM "NativeUser"',
op: 'db',
status: 'ok',
origin: 'auto.db.otel.postgres',
}),
description: 'SELECT * FROM "NativeUser"',
op: 'db',
status: 'ok',
origin: 'auto.db.otel.postgres',
}),
]),
};
]),
};

await createRunner(__dirname, 'scenario-native.js')
.withDockerCompose({
workingDirectory: [__dirname],
setupCommand: 'yarn',
})
.expect({ transaction: EXPECTED_TRANSACTION })
.start()
.completed();
await createRunner(__dirname, 'scenario-native.js')
.withDockerCompose({
workingDirectory: [__dirname],
setupCommand: 'yarn',
})
.expect({ transaction: EXPECTED_TRANSACTION })
.start()
.completed();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,38 @@ nan@~2.22.2:
resolved "https://registry.yarnpkg.com/nan/-/nan-2.22.2.tgz#6b504fd029fb8f38c0990e52ad5c26772fdacfbb"
integrity sha512-DANghxFkS1plDdRsX0X9pm0Z6SJNN6gBdtXfanwoZ8hooC5gosGFSBGRYHUVPz1asKA/kMRqDRdHrluZ61SpBQ==

pg-cloudflare@^1.2.5:
version "1.2.5"
resolved "https://registry.yarnpkg.com/pg-cloudflare/-/pg-cloudflare-1.2.5.tgz#2e3649c38a7a9c74a7e5327c8098a2fd9af595bd"
integrity sha512-OOX22Vt0vOSRrdoUPKJ8Wi2OpE/o/h9T8X1s4qSkCedbNah9ei2W2765be8iMVxQUsvgT7zIAT2eIa9fs5+vtg==
pg-cloudflare@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/pg-cloudflare/-/pg-cloudflare-1.3.0.tgz#386035d4bfcf1a7045b026f8b21acf5353f14d65"
integrity sha512-6lswVVSztmHiRtD6I8hw4qP/nDm1EJbKMRhf3HCYaqud7frGysPv7FYJ5noZQdhQtN2xJnimfMtvQq21pdbzyQ==

pg-connection-string@^2.9.0:
version "2.9.0"
resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-2.9.0.tgz#f75e06591fdd42ec7636fe2c6a03febeedbec9bf"
integrity sha512-P2DEBKuvh5RClafLngkAuGe9OUlFV7ebu8w1kmaaOgPcpJd1RIFh7otETfI6hAR8YupOLFTY7nuvvIn7PLciUQ==
pg-connection-string@^2.12.0:
version "2.12.0"
resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-2.12.0.tgz#4084f917902bb2daae3dc1376fe24ac7b4eaccf2"
integrity sha512-U7qg+bpswf3Cs5xLzRqbXbQl85ng0mfSV/J0nnA31MCLgvEaAo7CIhmeyrmJpOr7o+zm0rXK+hNnT5l9RHkCkQ==

pg-int8@1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/pg-int8/-/pg-int8-1.0.1.tgz#943bd463bf5b71b4170115f80f8efc9a0c0eb78c"
integrity sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==

pg-native@3.5.0:
version "3.5.0"
resolved "https://registry.yarnpkg.com/pg-native/-/pg-native-3.5.0.tgz#1a43c0d5f5744e40df3bf737c43178ce98984255"
integrity sha512-rj4LYouevTdKxvRLnvtOLEPOerkiPAqUdZE1K48IfQluEH/x7GrldEDdSaEOmJ6z7s6LQwDTpAPhm2s00iG8xw==
pg-native@3.7.0:
version "3.7.0"
resolved "https://registry.yarnpkg.com/pg-native/-/pg-native-3.7.0.tgz#1bd78031482c78dc5240c4350cddb291493dc34f"
integrity sha512-q2V5DynvPt4PD75q1DqZOUrieEgE4bf/flEeLCzzs8axgn8x2mRCUhd1DP0cqMz8FEdpVEDb0/zKblQWeijbGg==
dependencies:
libpq "^1.8.15"
pg-types "2.2.0"

pg-pool@^3.10.0:
version "3.10.0"
resolved "https://registry.yarnpkg.com/pg-pool/-/pg-pool-3.10.0.tgz#134b0213755c5e7135152976488aa7cd7ee1268d"
integrity sha512-DzZ26On4sQ0KmqnO34muPcmKbhrjmyiO4lCCR0VwEd7MjmiKf5NTg/6+apUEu0NF7ESa37CGzFxH513CoUmWnA==
pg-pool@^3.13.0:
version "3.13.0"
resolved "https://registry.yarnpkg.com/pg-pool/-/pg-pool-3.13.0.tgz#416482e9700e8f80c685a6ae5681697a413c13a3"
integrity sha512-gB+R+Xud1gLFuRD/QgOIgGOBE2KCQPaPwkzBBGC9oG69pHTkhQeIuejVIk3/cnDyX39av2AxomQiyPT13WKHQA==

pg-protocol@^1.10.0:
version "1.10.0"
resolved "https://registry.yarnpkg.com/pg-protocol/-/pg-protocol-1.10.0.tgz#a473afcbb1c6e5dc3ac24869ba3dd563f8a1ae1b"
integrity sha512-IpdytjudNuLv8nhlHs/UrVBhU0e78J0oIS/0AVdTbWxSOkFUVdsHC/NrorO6nXsQNDTT1kzDSOMJubBQviX18Q==
pg-protocol@^1.13.0:
version "1.13.0"
resolved "https://registry.yarnpkg.com/pg-protocol/-/pg-protocol-1.13.0.tgz#fdaf6d020bca590d58bb991b4b16fc448efe0511"
integrity sha512-zzdvXfS6v89r6v7OcFCHfHlyG/wvry1ALxZo4LqgUoy7W9xhBDMaqOuMiF3qEV45VqsN6rdlcehHrfDtlCPc8w==

pg-types@2.2.0:
version "2.2.0"
Expand All @@ -71,18 +71,18 @@ pg-types@2.2.0:
postgres-date "~1.0.4"
postgres-interval "^1.1.0"

pg@8.16.0:
version "8.16.0"
resolved "https://registry.yarnpkg.com/pg/-/pg-8.16.0.tgz#40b08eedb5eb1834252cf3e3629503e32e6c6c04"
integrity sha512-7SKfdvP8CTNXjMUzfcVTaI+TDzBEeaUnVwiVGZQD1Hh33Kpev7liQba9uLd4CfN8r9mCVsD0JIpq03+Unpz+kg==
pg@8.20.0:
version "8.20.0"
resolved "https://registry.yarnpkg.com/pg/-/pg-8.20.0.tgz#1a274de944cb329fd6dd77a6d371a005ba6b136d"
integrity sha512-ldhMxz2r8fl/6QkXnBD3CR9/xg694oT6DZQ2s6c/RI28OjtSOpxnPrUCGOBJ46RCUxcWdx3p6kw/xnDHjKvaRA==
dependencies:
pg-connection-string "^2.9.0"
pg-pool "^3.10.0"
pg-protocol "^1.10.0"
pg-connection-string "^2.12.0"
pg-pool "^3.13.0"
pg-protocol "^1.13.0"
pg-types "2.2.0"
pgpass "1.0.5"
optionalDependencies:
pg-cloudflare "^1.2.5"
pg-cloudflare "^1.3.0"

pgpass@1.0.5:
version "1.0.5"
Expand Down
3 changes: 2 additions & 1 deletion dev-packages/node-integration-tests/utils/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,8 @@ export function createRunner(...paths: string[]) {

if (process.env.DEBUG) log('stderr line', output);

if (ensureNoErrorOutput) {
// Ignore deprecation warnings for this purpose
if (ensureNoErrorOutput && !`${output}`.includes('DeprecationWarning:')) {
complete(new Error(`Expected no error output but got: '${output}'`));
}
});
Expand Down
9 changes: 8 additions & 1 deletion packages/node-core/src/integrations/console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@ export const consoleIntegration = defineIntegration((options: Partial<ConsoleInt
}

// Delegate breadcrumb handling to the core console integration.
const core = coreConsoleIntegration(options);
const core = coreConsoleIntegration({
...options,
filter: [
...(options.filter || []),
// Deprecation on Node 26 for module.require(), which is used by IITM
'[DEP0205] DeprecationWarning',
],
});
core.setup?.(client);
},
Comment on lines +42 to 51
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The Lambda-specific console instrumentation instrumentConsoleLambda bypasses configured filters, causing all console messages to be captured as breadcrumbs regardless of the filter settings.
Severity: LOW

Suggested Fix

Update the instrumentConsoleLambda function to apply the filters stored in the _filter set before calling triggerHandlers. The implementation should check if a console message matches any of the filters and, if so, prevent it from being captured.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: packages/node-core/src/integrations/console.ts#L42-L51

Potential issue: In Lambda environments, the `instrumentConsoleLambda` function is
registered to handle console instrumentation. This function unconditionally calls
`triggerHandlers` for every console message, ignoring any filters that have been
configured via `addConsoleInstrumentationFilter`. As a result, messages that are
intended to be filtered out, such as the `'[DEP0205] DeprecationWarning'`, are still
captured as breadcrumbs, leading to unnecessary noise in the telemetry data.

Did we get this right? 👍 / 👎 to inform future reviews.

};
Expand Down
2 changes: 1 addition & 1 deletion packages/node-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"build:tarball": "npm pack"
},
"dependencies": {
"@sentry-internal/node-native-stacktrace": "^0.4.0",
"@sentry-internal/node-native-stacktrace": "^0.5.0",
"@sentry/core": "10.52.0",
"@sentry/node": "10.52.0"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/profiling-node/scripts/prune-profiler-binaries.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const NODE_TO_ABI = {
20: '115',
22: '127',
24: '137',
26: '147',
};

if (NODE) {
Expand All @@ -83,6 +84,8 @@ if (NODE) {
NODE = NODE_TO_ABI['22'];
} else if (NODE.startsWith('24')) {
NODE = NODE_TO_ABI['24'];
} else if (NODE.startsWith('26')) {
NODE = NODE_TO_ABI['26'];
} else {
ARGV_ERRORS.push(
`❌ Sentry: Invalid node version passed as argument, please make sure --target_node is a valid major node version. Supported versions are ${Object.keys(
Expand Down
2 changes: 1 addition & 1 deletion packages/profiling-node/src/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ class ContinuousProfiler {

/** Exported only for tests. */
export const _nodeProfilingIntegration = ((): ProfilingIntegration<NodeClient> => {
if (![16, 18, 20, 22, 24].includes(NODE_MAJOR)) {
if (![16, 18, 20, 22, 24, 26].includes(NODE_MAJOR)) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Profiling warning message omits Node 26 from supported list

Medium Severity

The version check on line 642 was updated to include 26 in the supported list (![16, 18, 20, 22, 24, 26].includes(NODE_MAJOR)), but the warning message on line 647 still says "16, 18, 20, 22, 24". Users on unsupported versions (e.g., Node 27) will see an incomplete list of supported versions, omitting that 26 is also supported.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit f73ad06. Configure here.

consoleSandbox(() => {
// eslint-disable-next-line no-console
console.warn(
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7694,10 +7694,10 @@
detect-libc "^2.0.3"
node-abi "^3.73.0"

"@sentry-internal/node-native-stacktrace@^0.4.0":
version "0.4.0"
resolved "https://registry.yarnpkg.com/@sentry-internal/node-native-stacktrace/-/node-native-stacktrace-0.4.0.tgz#8f6e7a21537373a5623714c14d3350e1bb4602f0"
integrity sha512-cuRBBqnsHOJJqLCii9GvwedzjetsihIarq7TxCjgG88JyF8TZWRMlUBu/OogWhYZVU8uHqAeSvpbzolnmdhdkw==
"@sentry-internal/node-native-stacktrace@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@sentry-internal/node-native-stacktrace/-/node-native-stacktrace-0.5.0.tgz#834a5326fd45a97d1abe3b6110e9b268c7a2fa4e"
integrity sha512-vi+yY8D0TgUdpd8ja2BPqm689N+WZPWfXNkx0fzKYlVRGymUpQeyUrz2b6dscYE8Qr3ZiA6sz8RtXeQy1r9ZTQ==
dependencies:
detect-libc "^2.0.4"
node-abi "^3.89.0"
Expand Down
Loading