Skip to content

SymDB: Stop defaulting empty/nil env and version to 'none' in ServiceVersion#5694

Merged
p-datadog merged 2 commits into
masterfrom
symdb-service-version-no-none-default
May 8, 2026
Merged

SymDB: Stop defaulting empty/nil env and version to 'none' in ServiceVersion#5694
p-datadog merged 2 commits into
masterfrom
symdb-service-version-no-none-default

Conversation

@p-datadog

Copy link
Copy Markdown
Member

What does this PR do?

Drops the empty/nil → "none" rewriting of env and version in Datadog::SymbolDatabase::ServiceVersion#initialize. Both fields now pass through unchanged.

Before:

@env     = env.to_s.empty? ? 'none' : env.to_s
@version = version.to_s.empty? ? 'none' : version.to_s

After:

@env     = env
@version = version

ServiceVersion's role is to wrap a payload, not to sanitize inputs; defaulting belongs at the caller (Component) where the source of env/version is known and the sentinel choice (if any) can be made deliberately.

Master has no non-test callers of ServiceVersion.new (verified via grep -rn 'ServiceVersion.new' lib/ — no matches), so this is contained to the spec changes in this PR.

The four converts ... to "none" tests are replaced with four passes ... through unchanged tests covering the same nil/empty inputs, asserting on the new pass-through behavior. The two to_h tests for "none" defaulting are similarly replaced.

Motivation:

Extracted from #5431 to land the behavior change independently of the broader symbol-database upload work. ServiceVersion is currently only used by tests — no production callers exist on master.

Change log entry

None.

Note on pre-existing failure

to_json produces valid JSON for complete Ruby payload (line 142) was already failing on master with NameError: uninitialized constant Datadog::SymbolDatabase::Symbol — the spec file is missing require 'datadog/symbol_database/symbol'. This PR does not address it (out of scope).

How to test the change?

bundle exec rspec spec/datadog/symbol_database/service_version_spec.rb

Verification on this branch: 14 pass, 1 fail (the pre-existing failure described above).

  • bundle exec steep check lib/datadog/symbol_database/service_version.rb — No type error detected
  • bundle exec rake standard — clean

…Version

ServiceVersion previously rewrote +env+ and +version+ inputs:
  @env     = env.to_s.empty? ? 'none' : env.to_s
  @Version = version.to_s.empty? ? 'none' : version.to_s

Drops the rewriting — both fields now pass through unchanged. Empty
strings stay empty strings; nil stays nil. ServiceVersion's role is
to wrap a payload, not to sanitize inputs; defaulting belongs at the
caller (Component) where the source of env/version is known and the
sentinel choice (if any) can be made deliberately.

Master has no non-test callers of +ServiceVersion.new+ (verified via
+grep -rn 'ServiceVersion.new' lib/+ — no matches), so this is
contained to the spec changes in this PR.

The four +converts ... to "none"+ tests are replaced with four
+passes ... through unchanged+ tests covering the same nil/empty
inputs, asserting on the new pass-through behavior. The two +to_h+
tests for +none+ defaulting are similarly replaced.

Extracted from #5431 to land the behavior change independently of
the broader symbol-database upload work.

Note on pre-existing failure: +to_json produces valid JSON for
complete Ruby payload+ (line 142) was already failing on master with
+NameError: uninitialized constant Datadog::SymbolDatabase::Symbol+ —
the spec file is missing +require 'datadog/symbol_database/symbol'+.
Out of scope for this PR; not addressed here.

Verification:
- bundle exec rspec spec/datadog/symbol_database/service_version_spec.rb
  → 14 pass, 1 fail (the pre-existing failure described above)
- bundle exec steep check lib/datadog/symbol_database/service_version.rb
  → No type error detected.
- bundle exec rake standard → clean

Co-Authored-By: Claude <[email protected]>
@p-datadog
p-datadog requested a review from a team as a code owner May 6, 2026 19:33
@p-datadog p-datadog 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 May 6, 2026
The test +to_json produces valid JSON for complete Ruby payload+
constructs +Datadog::SymbolDatabase::Symbol.new(...)+ but the spec
file was missing +require 'datadog/symbol_database/symbol'+. The test
was failing on master with:

  NameError: uninitialized constant Datadog::SymbolDatabase::Symbol

Add the missing require. The spec is already in this PR's diff for
the +none+ defaulting changes, so addressing the failure here keeps
this branch's CI green. Flagged as out-of-scope in the original PR
body — that was hand-waving; the fix is trivial and the file is
already being modified.

Verification:
- bundle exec rspec spec/datadog/symbol_database/service_version_spec.rb
  → 15 examples, 0 failures (up from 14/15)

Co-Authored-By: Claude <[email protected]>
@datadog-prod-us1-6

datadog-prod-us1-6 Bot commented May 6, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 97.22% (-0.01%)

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

@pr-commenter

pr-commenter Bot commented May 6, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-05-06 19:59:32

Comparing candidate commit bcad13a in PR branch symdb-service-version-no-none-default with baseline commit 65b7637 in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 45 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 ----------------------------------'

@ivoanjo ivoanjo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍 LGTM

@p-datadog
p-datadog merged commit 0dbb138 into master May 8, 2026
415 of 416 checks passed
@p-datadog
p-datadog deleted the symdb-service-version-no-none-default branch May 8, 2026 01:31
@dd-octo-sts dd-octo-sts Bot added this to the 2.33.0 milestone May 8, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants