Skip to content

tracing(kafka): add batched tracing for kafka consumes (kafkajs | confluent-kafka)#7479

Merged
BridgeAR merged 9 commits intomasterfrom
conti/port-kafka-span-links-with-confluent
Apr 9, 2026
Merged

tracing(kafka): add batched tracing for kafka consumes (kafkajs | confluent-kafka)#7479
BridgeAR merged 9 commits intomasterfrom
conti/port-kafka-span-links-with-confluent

Conversation

@wconti27
Copy link
Copy Markdown
Contributor

What does this PR do?

Adds tracing for kafka batch operations, for kafkajs and confluent-kafka. Adds span links to upstream parent producer spans.

Motivation

Port of customer PR: fix(kafkajs): add APM tracing support for batch consumer.

Additional Notes

Thank you for the contribution @slukes

@wconti27 wconti27 self-assigned this Feb 10, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 10, 2026

Overall package size

Self size: 5.45 MB
Deduped: 6.29 MB
No deduping: 6.29 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.0.0 | 81.15 kB | 815.98 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 10, 2026

Codecov Report

❌ Patch coverage is 0% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.25%. Comparing base (a7de9c0) to head (2977b68).
⚠️ Report is 34 commits behind head on master.

Files with missing lines Patch % Lines
...kages/datadog-plugin-kafkajs/src/batch-consumer.js 0.00% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7479      +/-   ##
==========================================
- Coverage   74.27%   74.25%   -0.02%     
==========================================
  Files         765      765              
  Lines       35793    35800       +7     
==========================================
- Hits        26586    26585       -1     
- Misses       9207     9215       +8     
Flag Coverage Δ
aiguard-macos 39.41% <ø> (-0.10%) ⬇️
aiguard-ubuntu 39.53% <ø> (-0.10%) ⬇️
aiguard-windows 39.20% <ø> (-0.10%) ⬇️
apm-capabilities-tracing-macos 49.17% <0.00%> (-0.02%) ⬇️
apm-capabilities-tracing-ubuntu 49.08% <0.00%> (-0.02%) ⬇️
apm-capabilities-tracing-windows 48.94% <0.00%> (-0.03%) ⬇️
apm-integrations-child-process 38.74% <ø> (-0.13%) ⬇️
apm-integrations-couchbase-18 37.52% <ø> (-0.13%) ⬇️
apm-integrations-couchbase-eol 38.01% <ø> (-0.13%) ⬇️
apm-integrations-oracledb 37.87% <ø> (-0.10%) ⬇️
appsec-express 55.38% <ø> (-0.08%) ⬇️
appsec-fastify 51.72% <ø> (-0.07%) ⬇️
appsec-graphql 51.87% <ø> (-0.08%) ⬇️
appsec-kafka 44.46% <0.00%> (-0.12%) ⬇️
appsec-ldapjs 44.11% <ø> (-0.08%) ⬇️
appsec-lodash 43.71% <ø> (-0.08%) ⬇️
appsec-macos 58.15% <ø> (-0.07%) ⬇️
appsec-mongodb-core 48.90% <ø> (-0.08%) ⬇️
appsec-mongoose 49.55% <ø> (-0.08%) ⬇️
appsec-mysql 51.07% <ø> (-0.08%) ⬇️
appsec-node-serialize 43.29% <ø> (-0.08%) ⬇️
appsec-passport 47.76% <ø> (-0.09%) ⬇️
appsec-postgres 50.70% <ø> (-0.07%) ⬇️
appsec-sourcing 42.54% <ø> (-0.08%) ⬇️
appsec-stripe 44.73% <ø> (-0.09%) ⬇️
appsec-template 43.46% <ø> (-0.08%) ⬇️
appsec-ubuntu 58.23% <ø> (-0.07%) ⬇️
appsec-windows 57.97% <ø> (-0.07%) ⬇️
instrumentations-instrumentation-bluebird 32.32% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-body-parser 40.63% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-child_process 38.07% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-cookie-parser 34.35% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-express 34.67% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-express-mongo-sanitize 34.48% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-express-session 40.27% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-fs 32.00% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-generic-pool 29.46% <ø> (ø)
instrumentations-instrumentation-http 39.99% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-knex 32.39% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-mongoose 33.51% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-multer 40.38% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-mysql2 38.40% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-passport 44.16% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-passport-http 43.84% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-passport-local 44.37% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-pg 37.84% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-promise 32.25% <ø> (-0.11%) ⬇️
instrumentations-instrumentation-promise-js 32.26% <ø> (-0.11%) ⬇️
instrumentations-instrumentation-q 32.30% <ø> (-0.11%) ⬇️
instrumentations-instrumentation-url 32.22% <ø> (-0.11%) ⬇️
instrumentations-instrumentation-when 32.27% <ø> (-0.11%) ⬇️
llmobs-ai 41.61% <ø> (-0.10%) ⬇️
llmobs-anthropic 40.84% <ø> (-0.09%) ⬇️
llmobs-bedrock 39.32% <ø> (-0.08%) ⬇️
llmobs-google-genai 39.87% <ø> (-0.22%) ⬇️
llmobs-langchain 39.34% <ø> (-0.09%) ⬇️
llmobs-openai 44.12% <ø> (-0.09%) ⬇️
llmobs-vertex-ai 40.13% <ø> (-0.09%) ⬇️
platform-core 31.47% <ø> (ø)
platform-esbuild 34.42% <ø> (ø)
platform-instrumentations-misc 34.11% <ø> (ø)
platform-shimmer 37.56% <ø> (ø)
platform-unit-guardrails 32.89% <ø> (ø)
platform-webpack 19.96% <ø> (ø)
plugins-azure-durable-functions 25.74% <ø> (ø)
plugins-azure-event-hubs 25.90% <ø> (ø)
plugins-azure-service-bus 25.26% <ø> (ø)
plugins-bullmq 43.61% <ø> (-0.10%) ⬇️
plugins-cassandra 38.02% <ø> (-0.10%) ⬇️
plugins-cookie 26.96% <ø> (ø)
plugins-cookie-parser 26.75% <ø> (ø)
plugins-crypto 26.73% <ø> (ø)
plugins-dd-trace-api 38.43% <ø> (-0.10%) ⬇️
plugins-express-mongo-sanitize 26.89% <ø> (ø)
plugins-express-session 26.70% <ø> (ø)
plugins-fastify 42.36% <ø> (-0.09%) ⬇️
plugins-fetch 38.51% <ø> (-0.10%) ⬇️
plugins-fs 38.75% <ø> (-0.10%) ⬇️
plugins-generic-pool 25.94% <ø> (ø)
plugins-google-cloud-pubsub 45.69% <ø> (-0.09%) ⬇️
plugins-grpc 41.01% <ø> (-0.09%) ⬇️
plugins-handlebars 26.94% <ø> (ø)
plugins-hapi 40.27% <ø> (-0.24%) ⬇️
plugins-hono 40.61% <ø> (-0.10%) ⬇️
plugins-ioredis 38.60% <ø> (-0.10%) ⬇️
plugins-knex 26.57% <ø> (ø)
plugins-langgraph 37.99% <ø> (-0.10%) ⬇️
plugins-ldapjs 24.43% <ø> (ø)
plugins-light-my-request 26.30% <ø> (ø)
plugins-limitd-client 32.60% <ø> (-0.10%) ⬇️
plugins-lodash 26.03% <ø> (ø)
plugins-mariadb 39.61% <ø> (-0.15%) ⬇️
plugins-memcached 38.34% <ø> (-0.10%) ⬇️
plugins-microgateway-core 39.34% <ø> (-0.10%) ⬇️
plugins-moleculer 40.63% <ø> (-0.09%) ⬇️
plugins-mongodb 39.27% <ø> (-0.10%) ⬇️
plugins-mongodb-core 39.12% <ø> (-0.13%) ⬇️
plugins-mongoose 38.92% <ø> (-0.19%) ⬇️
plugins-multer 26.70% <ø> (ø)
plugins-mysql 39.45% <ø> (-0.10%) ⬇️
plugins-mysql2 39.40% <ø> (-0.10%) ⬇️
plugins-node-serialize 27.00% <ø> (ø)
plugins-opensearch 37.74% <ø> (-0.10%) ⬇️
plugins-passport-http 26.76% <ø> (ø)
plugins-postgres 35.57% <ø> (-0.11%) ⬇️
plugins-process 26.73% <ø> (ø)
plugins-pug 26.96% <ø> (ø)
plugins-redis 39.04% <ø> (-0.10%) ⬇️
plugins-router 43.36% <ø> (-0.10%) ⬇️
plugins-sequelize 25.55% <ø> (ø)
plugins-test-and-upstream-amqp10 38.47% <ø> (-0.25%) ⬇️
plugins-test-and-upstream-amqplib 44.37% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-apollo 39.24% <ø> (-0.09%) ⬇️
plugins-test-and-upstream-avsc 38.69% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-bunyan 33.93% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-connect 40.93% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-graphql 40.28% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-koa 40.52% <ø> (-0.23%) ⬇️
plugins-test-and-upstream-protobufjs 38.92% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-rhea 44.37% <ø> (-0.13%) ⬇️
plugins-undici 39.36% <ø> (-0.09%) ⬇️
plugins-url 26.73% <ø> (ø)
plugins-valkey 38.31% <ø> (-0.10%) ⬇️
plugins-vm 26.73% <ø> (ø)
plugins-winston 34.12% <ø> (-0.24%) ⬇️
plugins-ws 42.12% <ø> (-0.10%) ⬇️
profiling-macos 40.65% <ø> (-0.10%) ⬇️
profiling-ubuntu 40.78% <ø> (-0.10%) ⬇️
profiling-windows 42.30% <ø> (-0.10%) ⬇️
serverless-azure-functions-client 25.62% <ø> (ø)
serverless-azure-functions-eventhubs 25.62% <ø> (ø)
serverless-azure-functions-servicebus 25.62% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 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.

@datadog-official
Copy link
Copy Markdown

datadog-official Bot commented Feb 10, 2026

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 0.00%
Overall Coverage: 68.71% (-0.01%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 2977b68 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Feb 10, 2026

Benchmarks

Benchmark execution time: 2026-04-03 18:29:51

Comparing candidate commit 2977b68 in PR branch conti/port-kafka-span-links-with-confluent with baseline commit a7de9c0 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 229 metrics, 31 unstable metrics.

@wconti27 wconti27 marked this pull request as ready for review February 18, 2026 15:41
@wconti27 wconti27 requested review from a team as code owners February 18, 2026 15:41
@tlhunter
Copy link
Copy Markdown
Member

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bbc4c41e3d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/datadog-plugin-kafkajs/src/batch-consumer.js Outdated
Copy link
Copy Markdown
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

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

This is mostly looking good! One issue is the mentioned receiving of not instrumented messages and potential unhandled rejections in our tests.

Comment thread packages/datadog-plugin-kafkajs/src/batch-consumer.js Outdated
Comment thread packages/datadog-plugin-confluentinc-kafka-javascript/test/index.spec.js Outdated
@slukes
Copy link
Copy Markdown
Contributor

slukes commented Apr 3, 2026

Hello 👋

Any news on this one? Can I do something to help?

@wconti27
Copy link
Copy Markdown
Contributor Author

wconti27 commented Apr 3, 2026

This is mostly looking good! One issue is the mentioned receiving of not instrumented messages and potential unhandled rejections in our tests.

Added the requested changes!

@wconti27 wconti27 requested a review from BridgeAR April 3, 2026 13:15
Copy link
Copy Markdown
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the fix!

@BridgeAR BridgeAR merged commit 9ed88dc into master Apr 9, 2026
891 of 892 checks passed
@BridgeAR BridgeAR deleted the conti/port-kafka-span-links-with-confluent branch April 9, 2026 12:40
dd-octo-sts Bot pushed a commit that referenced this pull request Apr 10, 2026
…fluent-kafka) (#7479)

* add batched tracing for kafka consumes

* fix batch messages to prevent mutations between test cases
@dd-octo-sts dd-octo-sts Bot mentioned this pull request Apr 10, 2026
juan-fernandez pushed a commit that referenced this pull request Apr 10, 2026
…fluent-kafka) (#7479)

* add batched tracing for kafka consumes

* fix batch messages to prevent mutations between test cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants