Skip to content

Conversation

@Leiyks
Copy link
Contributor

@Leiyks Leiyks commented Dec 23, 2025

Description

Problem

DBM correlation was broken for PDO prepared statements. The traceparent SQL comment which DBM uses to correlate database queries with APM traces contained a span_id that didn't match the span representing the actual query execution.

Root Cause
When using prepared statements (PDO::prepare() + PDOStatement::execute()):

  • PDO::prepare() created a "PDO.prepare" span and injected traceparent with that span's ID
  • PDOStatement::execute() created a separate "PDOStatement.execute" span as a sibling
  • Mismatch: traceparent referenced the prepare span, but the actual query execution happened in the execute span

This prevented DBM from properly correlating database queries with their corresponding APM spans.

Solution
Following the RFC we now use SERVICE mode (DBM_PROPAGATION_SERVICE) for prepared statements instead of FULL mode.

@codecov-commenter
Copy link

codecov-commenter commented Dec 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.64%. Comparing base (98a31cb) to head (c45a6f6).
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3545      +/-   ##
==========================================
- Coverage   61.78%   61.64%   -0.14%     
==========================================
  Files         139      139              
  Lines       13051    13051              
  Branches     1712     1712              
==========================================
- Hits         8063     8045      -18     
- Misses       4225     4241      +16     
- Partials      763      765       +2     

see 4 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 98a31cb...c45a6f6. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pr-commenter
Copy link

pr-commenter bot commented Dec 23, 2025

Benchmarks [ tracer ]

Benchmark execution time: 2025-12-30 17:21:12

Comparing candidate commit 753738a in PR branch leiyks/APMS-17965 with baseline commit 575faf4 in branch master.

Found 5 performance improvements and 8 performance regressions! Performance is the same for 180 metrics, 1 unstable metrics.

scenario:MessagePackSerializationBench/benchMessagePackSerialization

  • 🟥 execution_time [+3.317µs; +6.523µs] or [+3.247%; +6.385%]

scenario:MessagePackSerializationBench/benchMessagePackSerialization-opcache

  • 🟥 execution_time [+14.734µs; +15.686µs] or [+14.587%; +15.529%]

scenario:PDOBench/benchPDOOverhead

  • 🟩 execution_time [-152.434µs; -149.390µs] or [-69.194%; -67.812%]

scenario:PDOBench/benchPDOOverhead-opcache

  • 🟩 execution_time [-148.277µs; -145.555µs] or [-68.261%; -67.008%]

scenario:PDOBench/benchPDOOverheadWithDBM

  • 🟩 execution_time [-153.686µs; -150.072µs] or [-69.428%; -67.795%]

scenario:PDOBench/benchPDOOverheadWithDBM-opcache

  • 🟩 execution_time [-147.870µs; -145.800µs] or [-68.152%; -67.198%]

scenario:SamplingRuleMatchingBench/benchGlobMatching1

  • 🟥 execution_time [+44.315ns; +122.885ns] or [+2.016%; +5.591%]

scenario:SamplingRuleMatchingBench/benchRegexMatching1

  • 🟥 execution_time [+91.066ns; +162.734ns] or [+7.738%; +13.827%]

scenario:SamplingRuleMatchingBench/benchRegexMatching2

  • 🟥 execution_time [+123.070ns; +194.130ns] or [+10.536%; +16.619%]

scenario:SamplingRuleMatchingBench/benchRegexMatching3

  • 🟥 execution_time [+120.767ns; +192.633ns] or [+10.277%; +16.393%]

scenario:SamplingRuleMatchingBench/benchRegexMatching4

  • 🟥 execution_time [+118.031ns; +162.569ns] or [+10.193%; +14.039%]

scenario:SpanBench/benchOpenTelemetryAPI

  • 🟥 mem_peak [+1.700MB; +1.706MB] or [+4.115%; +4.128%]

scenario:TraceSerializationBench/benchSerializeTrace

  • 🟩 execution_time [-36.572µs; -26.928µs] or [-8.107%; -5.969%]

@Leiyks Leiyks force-pushed the leiyks/APMS-17965 branch 5 times, most recently from c1810e9 to 753738a Compare December 30, 2025 16:17
@Leiyks Leiyks force-pushed the leiyks/APMS-17965 branch from 753738a to 86ffb66 Compare January 5, 2026 17:12
@Leiyks Leiyks marked this pull request as ready for review January 6, 2026 14:05
@Leiyks Leiyks requested review from a team as code owners January 6, 2026 14:05
@Leiyks Leiyks force-pushed the leiyks/APMS-17965 branch 5 times, most recently from aba777b to fc4db39 Compare January 8, 2026 12:57
Signed-off-by: Alexandre Rulleau <alexandre.rulleau@datadoghq.com>
@Leiyks Leiyks force-pushed the leiyks/APMS-17965 branch from fc4db39 to c45a6f6 Compare January 8, 2026 12:58
@Leiyks Leiyks merged commit a507818 into master Jan 9, 2026
2003 of 2006 checks passed
@Leiyks Leiyks deleted the leiyks/APMS-17965 branch January 9, 2026 14:05
@github-actions github-actions bot added this to the 1.16.0 milestone Jan 9, 2026
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.

4 participants