Skip to content

[BUG]: prisma read replica instrumentation #7159

@TheLevti

Description

@TheLevti

Tracer Version(s)

5.67.0

Node.js Version(s)

22

Bug Report

We have noticed that using a prisma setup with read replicas (using the @prisma/extension-read-replicas extension), dd-trace incorrectly traces prisma spans.

In particular all SELECT queries (except inside transaction) are still instrumented with writer metadata (host is wrong etc.). I have verified via DBM that the actual query is running on the reader though. It would be important for APM to see and verify that the reader instances are used and not writer.

Reproduction Code

See basic setup for the @prisma/extension-read-replicas extension and then enable the prisma tracing plugin.

Error Logs

not applicable

Tracer Config

  tracer.init({
    logInjection: true,
    startupLogs: false,
    plugins: false,
    runtimeMetrics: true
  });

  tracer.use('http', {
    blocklist
  });
  tracer.use('prisma');
  tracer.use('pg');
  tracer.use('ioredis');
  tracer.use('express');
  tracer.use('redis');
  tracer.use('kafkajs');
  tracer.use('grpc');
  tracer.use('fetch');
  tracer.use('child_process');
  tracer.use('net');

Operating System

node:22-bookworm-slim

Bundling

Unsure

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions