Skip to content

Fix WaterDrop propagation with frozen headers - #6182

Open
vicentereig wants to merge 4 commits into
DataDog:masterfrom
vicentereig:fix/waterdrop-copy-frozen-headers
Open

Fix WaterDrop propagation with frozen headers#6182
vicentereig wants to merge 4 commits into
DataDog:masterfrom
vicentereig:fix/waterdrop-copy-frozen-headers

Conversation

@vicentereig

Copy link
Copy Markdown

Summary

WaterDrop can receive frozen header hashes from rdkafka consumer messages. The WaterDrop integration currently mutates that hash when distributed tracing or DSM propagation is enabled, which raises FrozenError.

Copy the headers once before either propagation path runs. This preserves the caller-owned hash and keeps the outbound hash mutable.

Testing

  • BUNDLE_GEMFILE=gemfiles/ruby_3.3_waterdrop_latest.gemfile rbenv exec bundle exec rspec spec/datadog/tracing/contrib/waterdrop/middleware_spec.rb
  • 13 examples, 0 failures

This patch was prepared with coding-agent assistance. I reviewed the implementation and tests and verified the reproduction.

@vpellan vpellan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hello! Thanks for your contribution, I've left some comments, I will start the CI and if everything is green, I'll approve and merge the PR

Comment thread spec/datadog/tracing/contrib/waterdrop/middleware_spec.rb Outdated
Comment thread lib/datadog/tracing/contrib/waterdrop/middleware.rb Outdated
vicentereig and others added 2 commits August 13, 2026 18:17
Co-authored-by: Victor Pellan <37553749+vpellan@users.noreply.github.com>
@vicentereig

Copy link
Copy Markdown
Author

@vpellan You got it, I appreciate your time!

@vicentereig
vicentereig requested a review from vpellan August 13, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Was opened by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants