Skip to content

Sentry.postgresJsIntegration() not creating any DB spansΒ #17889

@aldy505

Description

@aldy505

Is there an existing issue for this?

How do you use Sentry?

Self-hosted/on-premise

Which SDK are you using?

@sentry/node

SDK Version

10.18.0

Framework Version

Node 22.16.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

Init script:

import { parseConfiguration } from "@internal-company/config";
import * as Sentry from "@sentry/node";
const environment = process.env.NODE_ENV ?? "development";
const sentryDebug: boolean | undefined =
    process.env.SENTRY_DEBUG != null ? process.env.SENTRY_DEBUG === "true" : undefined;
const configuration = await parseConfiguration();
Sentry.init({
    dsn: configuration.sentry.sentry_worker_dsn,
    sampleRate: configuration.sentry.sentry_sample_rate,
    environment,
    tracesSampleRate: configuration.sentry.sentry_traces_sample_rate,
    debug: sentryDebug ?? environment === "local",
    release: "{{SENTRY_VERSION}}+{{GIT_COMMIT_SHA}}",
    sendDefaultPii: true,
    enableLogs: true,
    integrations: [
        ...Sentry.getDefaultIntegrations({}),
        Sentry.zodErrorsIntegration(),
        Sentry.tediousIntegration(),
        Sentry.postgresJsIntegration(),
        Sentry.httpIntegration(),
        Sentry.requestDataIntegration(),
        Sentry.featureFlagsIntegration(),
    ],
});

Steps to Reproduce

  1. Enabled Sentry.postgresJsIntegration() based on this PR: feat(node): Add postgresjs instrumentationΒ #16665
  2. Create some traffic, hit some SQL queries

Expected Result

At least, I see that the postgres library was patched by the otel instrumentation hook. The queries coming from Tedious (SQL Server) was successfully captured, but any other query for PostgreJs was not captured.

Here's the trace waterfall:

Image

Actual Result

Oct 09 08:10:23 vm npm[970308]: > node --import ./dist/instrument.js ./dist/entry.js
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Initializing Sentry: process: 970321, thread: main.
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: InboundFilters
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: FunctionToString
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: LinkedErrors
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: RequestData
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: NodeSystemError
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Console
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: OnUncaughtException
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: OnUnhandledRejection
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: ContextLines
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: LocalVariablesAsync
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Context
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: ChildProcess
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: ProcessSession
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Modules
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Http
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: NodeFetch
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Express
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Fastify
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Graphql
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Hono
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Mongo
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Mongoose
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Mysql
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Mysql2
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Redis
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Postgres
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Prisma
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Hapi
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Koa
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Connect
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Tedious
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: GenericPool
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Kafka
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Amqplib
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: LruMemoizer
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: VercelAI
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: OpenAI
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: PostgresJs
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Firebase
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Anthropic_AI
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: Google_GenAI
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: ZodErrors
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: Integration installed: FeatureFlags
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: SDK initialized from ESM
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: @opentelemetry/api: Registered a global for diag v1.9.0.
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: @opentelemetry/api: Registered a global for trace v1.9.0.
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: @opentelemetry/api: Registered a global for propagation v1.9.0.
Oct 09 08:10:24 vm npm[970321]: Sentry Logger [log]: @opentelemetry/api: Registered a global for context v1.9.0.
Oct 09 08:10:27 vm npm[970321]: Sentry Logger [log]: @sentry/instrumentation-http Applying instrumentation patch for nodejs core module on require hook { module: 'http' }
Oct 09 08:10:27 vm npm[970321]: Sentry Logger [log]: @opentelemetry_sentry-patched/instrumentation-http Applying instrumentation patch for nodejs core module on require hook { module: 'http' }
Oct 09 08:10:27 vm npm[970321]: Sentry Logger [log]: @sentry/instrumentation-http Applying instrumentation patch for nodejs core module on require hook { module: 'https' }
Oct 09 08:10:27 vm npm[970321]: Sentry Logger [log]: @opentelemetry_sentry-patched/instrumentation-http Applying instrumentation patch for nodejs core module on require hook { module: 'https'>
Oct 09 08:10:27 vm npm[970321]: Sentry Logger [log]: @sentry/instrumentation-http Applying instrumentation patch for nodejs core module on require hook { module: 'http' }
Oct 09 08:10:27 vm npm[970321]: Sentry Logger [log]: @opentelemetry_sentry-patched/instrumentation-http Applying instrumentation patch for nodejs core module on require hook { module: 'http' }
Oct 09 08:10:27 vm npm[970321]: Sentry Logger [log]: @sentry/instrumentation-http Applying instrumentation patch for nodejs core module on require hook { module: 'https' }
Oct 09 08:10:27 vm npm[970321]: Sentry Logger [log]: @opentelemetry_sentry-patched/instrumentation-http Applying instrumentation patch for nodejs core module on require hook { module: 'https'>
Oct 09 08:10:27 vm npm[970321]: Sentry Logger [log]: @opentelemetry/instrumentation-redis Applying instrumentation patch for nodejs module file on require hook {
Oct 09 08:10:27 vm npm[970321]:   module: '@redis/client',
Oct 09 08:10:27 vm npm[970321]:   version: '5.8.2',
Oct 09 08:10:27 vm npm[970321]:   fileName: '@redis/client/dist/lib/client/multi-command.js',
Oct 09 08:10:27 vm npm[970321]:   baseDir: '/home/user/user/node_modules/@redis/client'
Oct 09 08:10:27 vm npm[970321]: }
Oct 09 08:10:27 vm npm[970321]: Sentry Logger [log]: @opentelemetry/instrumentation-redis Applying instrumentation patch for nodejs module file on require hook {
Oct 09 08:10:27 vm npm[970321]:   module: '@redis/client',
Oct 09 08:10:27 vm npm[970321]:   version: '5.8.2',
Oct 09 08:10:27 vm npm[970321]:   fileName: '@redis/client/dist/lib/client/index.js',
Oct 09 08:10:27 vm npm[970321]:   baseDir: '/home/user/user/node_modules/@redis/client'
Oct 09 08:10:27 vm npm[970321]: }
Oct 09 08:10:27 vm npm[970321]: Sentry Logger [log]: @opentelemetry/instrumentation-redis Applying instrumentation patch for module on require hook {
Oct 09 08:10:27 vm npm[970321]:   module: '@redis/client',
Oct 09 08:10:27 vm npm[970321]:   version: '5.8.2',
Oct 09 08:10:27 vm npm[970321]:   baseDir: '/home/user/user/node_modules/@redis/client'
Oct 09 08:10:27 vm npm[970321]: }
Oct 09 08:10:28 vm npm[970321]: Sentry Logger [log]: @opentelemetry/instrumentation-tedious Applying instrumentation patch for module on require hook {
Oct 09 08:10:28 vm npm[970321]:   module: 'tedious',
Oct 09 08:10:28 vm npm[970321]:   version: '18.6.1',
Oct 09 08:10:28 vm npm[970321]:   baseDir: '/home/user/user/node_modules/tedious'
Oct 09 08:10:28 vm npm[970321]: }
Oct 09 08:10:28 vm npm[970321]: Sentry Logger [log]: @sentry/instrumentation-hono Applying instrumentation patch for module on require hook {
Oct 09 08:10:28 vm npm[970321]:   module: 'hono',
Oct 09 08:10:28 vm npm[970321]:   version: '4.9.8',
Oct 09 08:10:28 vm npm[970321]:   baseDir: '/home/user/user/node_modules/hono'
Oct 09 08:10:28 vm npm[970321]: }
Oct 09 08:10:28 vm npm[970321]: Sentry Logger [log]: Recording is off, propagating context in a non-recording span
Oct 09 08:10:28 vm npm[970321]: Sentry Logger [log]: Recording is off, propagating context in a non-recording span
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: [Tracing] Starting sampled root span
Oct 09 08:10:29 vm npm[970321]:   op: < unknown op >
Oct 09 08:10:29 vm npm[970321]:   name: redis-connect
Oct 09 08:10:29 vm npm[970321]:   ID: 9baeb2bae56a385f
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: [Tracing] Finishing "< unknown op >" root span "redis-connect" with ID 9baeb2bae56a385f
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Recording is off, propagating context in a non-recording span
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: SpanExporter exported 1 spans, 0 spans are waiting for their parent spans to finish
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Recording is off, propagating context in a non-recording span
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: @sentry/instrumentation-http Handling finished outgoing request
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Initializing Sentry: process: 970321, thread: worker-2.
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: InboundFilters
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: FunctionToString
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: LinkedErrors
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: RequestData
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: NodeSystemError
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Console
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: OnUncaughtException
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: OnUnhandledRejection
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: ContextLines
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: LocalVariablesAsync
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Context
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: ChildProcess
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: ProcessSession
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Modules
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Http
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: NodeFetch
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Express
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Fastify
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Graphql
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Hono
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Mongo
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Mongoose
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Mysql
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Mysql2
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Redis
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Postgres
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Prisma
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Hapi
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Koa
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Connect
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Tedious
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: GenericPool
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Kafka
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Amqplib
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: LruMemoizer
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: VercelAI
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: OpenAI
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: PostgresJs
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Firebase
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Anthropic_AI
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: Google_GenAI
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: ZodErrors
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: Integration installed: FeatureFlags
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: SDK initialized from ESM
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: @opentelemetry/api: Registered a global for diag v1.9.0.
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: @opentelemetry/api: Registered a global for trace v1.9.0.
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: @opentelemetry/api: Registered a global for propagation v1.9.0.
Oct 09 08:10:29 vm npm[970321]: Sentry Logger [log]: @opentelemetry/api: Registered a global for context v1.9.0.
Oct 09 08:10:29 vm npm[970321]: {"level":30,"time":1759972229153,"pid":970321,"hostname":"vm","msg":"Server starting on http://0.0.0.0:5000"}
Oct 09 08:10:34 vm npm[970321]: Sentry Logger [log]: @sentry/instrumentation-http Handling finished outgoing request
Oct 09 08:10:34 vm npm[970321]: Sentry Logger [log]: Recording is off, propagating context in a non-recording span
Oct 09 08:11:24 vm npm[970321]: Sentry Logger [log]: Flushing client reports based on interval.
Oct 09 08:11:24 vm npm[970321]: Sentry Logger [log]: Flushing outcomes...
Oct 09 08:11:24 vm npm[970321]: Sentry Logger [log]: No outcomes to send
Oct 09 08:11:29 vm npm[970321]: Sentry Logger [log]: Flushing client reports based on interval.
Oct 09 08:11:29 vm npm[970321]: Sentry Logger [log]: Flushing outcomes...
Oct 09 08:11:29 vm npm[970321]: Sentry Logger [log]: No outcomes to send

Additional Context

Tip: React with πŸ‘ to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Metadata

Metadata

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions