Skip to content

Conversation

@tristal
Copy link

@tristal tristal commented Dec 15, 2025

What does this PR do?

Fixes #6063

This fixes the Prisma instrumentation to return actual trace IDs instead of hardcoded placeholder values, enabling proper Database Monitoring (DBM) correlation. The implementation:

  • Retrieves active span context from async local storage
  • Calls toTraceparent() to get the W3C traceparent with real trace IDs
  • Forces sampled flag to ensure Prisma generates engine spans
  • Falls back to placeholder when no active span exists

Motivation

Database Monitoring correlation requires real trace IDs to link database queries with application traces. The hardcoded placeholder prevents this correlation from working, making it impossible to identify which application requests are causing database load.

Plugin Checklist

Additional Notes

This is a bug fix (should be labeled semver-patch). The change maintains backward compatibility while fixing the DBM correlation issue.

Reviewer's Guide

The forced 01 sampling flag ensures Prisma generates engine spans, while dd-trace still makes the actual sampling decision when recording/sending those spans.

…tion

This fixes the Prisma instrumentation to return actual trace IDs instead
of hardcoded placeholder values, enabling proper Database Monitoring (DBM)
correlation. The implementation:

- Retrieves active span context from async local storage
- Calls toTraceparent() to get the W3C traceparent with real trace IDs
- Forces sampled flag to ensure Prisma generates engine spans
- Falls back to placeholder when no active span exists

Fixes database monitoring correlation issues where Prisma was injecting
fake trace IDs into SQL comments.
@tristal tristal requested review from a team as code owners December 15, 2025 09:45
@TheLevti
Copy link

Thank you for picking up this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Prisma DBM propagation does not work correctly.

2 participants