Skip to content

feat(data_streams): keep DSM pathway context in fiber storage on Ruby 3.2+ - #6558

Draft
ericfirth wants to merge 2 commits into
ericfirth/dsm2-456-dd-trace-rb-dsm-full-pathway-latency-inflated-by-minutesfrom
ericfirth/dsm2-484-dsm-pathway-fiber-storage
Draft

ericfirth wants to merge 2 commits into
ericfirth/dsm2-456-dd-trace-rb-dsm-full-pathway-latency-inflated-by-minutesfrom
ericfirth/dsm2-484-dsm-pathway-fiber-storage

Conversation

@ericfirth

Copy link
Copy Markdown
Contributor

Why

After #6532, a Data Streams pathway stops at any thread, fiber, or external enumerator started after a consume, so that work's produces start new pathways. Reviewers suggested fiber storage, which Ruby 3.2+ inherits into exactly that work.

What

On Ruby 3.2+ the pathway context lives in fiber storage, so work started after a consume links to the consumed message. Checkpoints now replace the context instead of mutating it, so inherited copies never write into each other.

Risk

Two-way door, scoped to Data Streams when enabled; revert this PR. Emitted data changes on Ruby 3.2+: a long-lived thread started from inside a consumer links to that message until its next checkpoint.

Details

Notes

🤖 Generated with Claude Code

Fiber storage is inherited by child fibers, external enumerators, and new
threads, so a pathway follows work started from the fiber that consumed
it. Ruby < 3.2 keeps fiber-locals.

Inherited storage shares the same object, and threads checkpoint
concurrently, so checkpoints now copy the context and install the copy
instead of mutating it in place.

DSM2-484

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ericfirth ericfirth added the AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos label Oct 23, 2026
@linear-code

linear-code Bot commented Oct 23, 2026

Copy link
Copy Markdown

DSM2-484

@dd-octo-sts dd-octo-sts Bot added the dsm Data Streams Monitoring label Oct 23, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 94.30% (+0.10%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 4670443 | Docs | View more details | Give us feedback!

This branch has not been deployed

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

Labels

AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos dsm Data Streams Monitoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant