Add Env field to DSM stats payload#5427
Conversation
The Ruby tracer was not including the Env field in the Data Streams Monitoring stats payload sent to the agent, causing services to show env:none in DSM despite having DD_ENV configured. This aligns the Ruby tracer with Java, which already sends Env as a top-level field. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
👋 Hey @DataDog/ruby-guild, please fill "Change log entry" section in the pull request description. If changes need to be present in CHANGELOG.md you can state it this way **Change log entry**
Yes. A brief summary to be placed into the CHANGELOG.md(possible answers Yes/Yep/Yeah) Or you can opt out like that **Change log entry**
None.(possible answers No/Nope/None) Visited at: 2026-03-06 15:56:07 UTC |
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
BenchmarksBenchmark execution time: 2026-03-09 14:03:03 Comparing candidate commit 1a66102 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 46 metrics, 0 unstable metrics.
|
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Strech
left a comment
There was a problem hiding this comment.
I think a little bit of RSpec adjustments needed, rest is good
Address review feedback from @Strech: - Use describe '#flush_stats' with context blocks for conditions - Use let statements for settings and processor - Move setup into before block Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 1a66102 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
What does this PR do?
Adds the
Envfield to the Data Streams Monitoring stats payload sent to the agent, matching Java tracer behavior.Motivation:
Ruby services show
env:nonein DSM despite havingDD_ENVconfigured. The root cause is the Ruby tracer omitsEnvfrom the DSM stats payload, while Java includes it. The env value is already available in@settings.env(used for pathway hash computation) — it just wasn't being serialized.Change log entry
Fix: Data Streams Monitoring now correctly reports the configured environment, resolving services showing as
env:none.Additional Notes:
Falls back to
'none'when env is not configured, consistent with the existing fallback incompute_pathway_hash(line 372).How to test the change?
bundle exec rspec spec/datadog/data_streams/processor_spec.rb— 32 examples, 0 failuresEnvis included in the flush payload with the configured value, and defaults to'none'when unset