Skip to content

[IGNORE] 🪞 #6108 - Honor DD_DOGSTATSD_URL/DD_DOGSTATSD_SOCKET for the runtime metrics statsd client - #6117

Open
p-datadog wants to merge 6 commits into
masterfrom
community-pr-6108
Open

[IGNORE] 🪞 #6108 - Honor DD_DOGSTATSD_URL/DD_DOGSTATSD_SOCKET for the runtime metrics statsd client#6117
p-datadog wants to merge 6 commits into
masterfrom
community-pr-6108

Conversation

@p-datadog

Copy link
Copy Markdown
Member

This PR mirrors the changes from the original community contribution to enable CI testing with maintainer privileges.

Original PR: #6108
Original Author: @ollym
Original Branch: ollym/dd-trace-rb:fix/runtime-metrics-dogstatsd-url
Mirror Type: exact mirror (preserves original commits and signatures)

Closes #6108


This is an automated mirror created to run CI checks. See tooling/mirror-community-pull-request.sh for details.

ollym and others added 3 commits July 26, 2026 17:27
…atsd client

Metrics::Client#default_statsd_client always passed an explicit host and
port to Datadog::Statsd.new, which bypasses dogstatsd-ruby's environment
resolution entirely: DD_DOGSTATSD_URL and DD_DOGSTATSD_SOCKET were ignored
and runtime metrics were silently sent to the UDP default (127.0.0.1:8125)
on UDS-only setups — for example pods instrumented by the Datadog Admission
Controller, which injects DD_DOGSTATSD_URL but not DD_AGENT_HOST.

When one of those variables is set, no explicit DD_AGENT_HOST or
DD_METRIC_AGENT_PORT is configured, and the installed dogstatsd-ruby
understands them (>= 5.6), construct the client without positional
arguments so dogstatsd-ruby resolves the transport itself. Explicit
host/port configuration keeps the existing behavior.

Fixes #6107

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review of PR #6108 noted the new public predicate statsd_transport_from_env?
had no entry in sig/datadog/core/metrics/client.rbs (its sibling private
helper dogstatsd_version is declared) and no @return tag. Declare it as
() -> bool and document the return in YARD. client.rb is in the Steepfile
ignore list, so this is signature/documentation consistency, not a Steep fix.
PR #6108 makes the runtime-metrics statsd client honor DD_DOGSTATSD_URL and
DD_DOGSTATSD_SOCKET but did not document them. Per the repo rule to record new
env vars in GettingStarted.md, add a paragraph in the runtime metrics section
covering the two variables, the >= 5.6 dogstatsd-ruby requirement, and the
DD_AGENT_HOST/DD_METRIC_AGENT_PORT precedence.
@p-datadog
p-datadog requested review from a team as code owners July 28, 2026 18:13
@dd-octo-sts

dd-octo-sts Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

👋 Hey @p-datadog, 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-07-28 18:13:33 UTC

@dd-octo-sts dd-octo-sts Bot added the core Involves Datadog core libraries label Jul 28, 2026
@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Jul 28, 2026

Copy link
Copy Markdown

Pipelines  Tests

Unblock PR with BitsAI

⚠️ Warnings

🚦 2 Pipeline jobs failed

DataDog/apm-reliability/dd-trace-rb | validate_supported_configurations_v2_local_file   View in Datadog   GitLab

Check Pull Request CI Status | all-jobs-are-green   View in Datadog   GitHub Actions

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

🔄 Datadog auto-retried 1 job - 1 passed on retry View in Datadog

🎯 Code Coverage (details)
Patch Coverage: 75.00%
Overall Coverage: 90.01% (-0.02%)

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 52efb8c | Docs | Datadog PR Page | Give us feedback!

@janine-c janine-c added the do-not-merge/WIP Not ready for merge label Jul 28, 2026
@janine-c

Copy link
Copy Markdown
Contributor

Adding the "do not merge/WIP" label to make it easier for my team to follow your [IGNORE] tag 🙂 If anything changes and you need review, just take that label off!

p-ddsign added 3 commits July 28, 2026 19:06
The `rake local_config_map:generate` template emits `require 'set'` with
single quotes (tasks/local_config_map.rake:69), which standard flags as
Style/StringLiterals (prefer double quotes). The generated file must be
run through `rake standard:fix` after regeneration; that step was skipped
when DD_DOGSTATSD_URL/DD_DOGSTATSD_SOCKET were added, so the standard/lint
CI job failed on line 3.

Change `require 'set'` to `require "set"`, matching what standard:fix
produces (and master's committed generated file).

Verified: `BUNDLE_GEMFILE=gemfiles/ruby-4.0.gemfile bundle exec rake
standard` on Ruby 4.0.6 (the CI config) exits 1 before this change with
the offense at supported_configurations.rb:3:9 and exits 0 after.
Address review comment: statsd_transport_from_env? is an internal helper
used only by default_statsd_client and should not expand the public surface
area of Datadog::Core::Metrics::Client.

- Moved the method (and its doc comment) into the existing private section
  in lib/datadog/core/metrics/client.rb
- Moved its signature under the private keyword in
  sig/datadog/core/metrics/client.rbs

Verified: rspec spec/datadog/core/metrics/client_spec.rb (85 examples, 0
failures); steep check (no type error); standardrb clean.
Address review comment: in the DD_DOGSTATSD_URL (>=5.6) and DD_DOGSTATSD_SOCKET
contexts, the before block referenced the metrics subject before setting the
Datadog::Statsd.new expectation. Because let(:options) is shadowed to
{single_thread: true} (no injected statsd), Client#initialize builds a real
statsd client, and with the URL/SOCKET env set that resolves a real env-based
(UDS) transport during test setup.

- Stub Datadog::Statsd.new with allow before building metrics so the
  initialization call returns the double instead of opening a real transport;
  the explicit expectation then observes only the #default_statsd_client call
- Stub statsd_client#close since @statsd is now the double closed by the
  after hook
- Applied to both flagged locations (URL >=5.6 branch and SOCKET context)

Verified: rspec spec/datadog/core/metrics/client_spec.rb (85 examples, 0
failures); standardrb clean.
@pr-commenter

pr-commenter Bot commented Jul 29, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-07-29 00:33:46

Comparing candidate commit 52efb8c in PR branch community-pr-6108 with baseline commit 616dc84 in branch master.

📊 Benchmarking dashboard

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

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:tracing - trace.to_digest - Continue

  • unstable throughput [-1401.664op/s; +1667.970op/s] or [-4.802%; +5.714%]

@vpellan vpellan mentioned this pull request Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Involves Datadog core libraries do-not-merge/WIP Not ready for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants