Skip to content

refactor(config): peer service revamp#4653

Merged
funyjane merged 26 commits intomainfrom
config-revamp/peer-service
Apr 10, 2026
Merged

refactor(config): peer service revamp#4653
funyjane merged 26 commits intomainfrom
config-revamp/peer-service

Conversation

@funyjane
Copy link
Copy Markdown
Collaborator

@funyjane funyjane commented Apr 10, 2026

What does this PR do? Coninues the following PR: #4483

PR was created due to permission issues, I was unable to merge the fork branch initially.

Motivation

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • New code is free of linting errors. You can check this by running make lint locally.
  • New code doesn't break existing tests. You can check this by running make test locally.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • All generated files are up to date. You can check this by running make generate locally.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild. Make sure all nested modules are up to date by running make fix-modules locally.

Unsure? Have a question? Request a review!

funyjane and others added 26 commits February 27, 2026 10:39
Move peerServiceDefaultsEnabled and peerServiceMappings from the
tracer's local config struct to internal/config.Config. These fields
already existed in the global config singleton but lacked getter/setter
methods. The tracer now reads/writes peer service configuration through
the global config accessors instead of maintaining local copies.
…e defaults

- Fix gofmt: remove extra blank line left from field removal
- Keep schema-dependent peerServiceDefaultsEnabled logic in the tracer
  since spanAttributeSchemaVersion uses namingschema (understands "v1")
  while loadConfig uses getInt (can't parse "v1"). Add TODO to move once
  spanAttributeSchemaVersion is fully migrated.
SetPeerServiceMappings and SetPeerServiceMapping have non-standard
signatures (map param / three value params) that the reflective test
helper cannot auto-generate values for. Register them as special cases.
Address PR review comments: move the peer service defaults enabled logic
(schema-dependent calculation) from tracer's newConfig() to internal
config's loadConfig(). Add parseSpanAttributeSchema parser that handles
"v0"/"v1" string values (matching namingschema behavior), replacing the
previous getInt call that couldn't parse these formats.
…okup

- Add getIntWithParser to configprovider instead of calling get() directly
- Keep all provider.getX calls together in loadConfig; move the
  schema-dependent peer service defaults override to the derived
  evaluations section below
- Replace PeerServiceMappings map in TracerConf with a PeerServiceMapping
  func for single-key lookups, avoiding lock contention and per-call map
  copies on the hot path (setPeerService is called for every span)
- Update setPeerService to use the function-based lookup with nil guard
- Fix CiVisibility TracerConf test to compare fields individually since
  functions cannot be compared with reflect.DeepEqual
Follow the existing configprovider pattern: use getString to read the
raw DD_TRACE_SPAN_ATTRIBUTE_SCHEMA value and parse it in the derived
evaluations section with parseSpanAttributeSchema, matching how
featureFlags and logToStdout are handled. Remove the getIntWithParser
method that was just a passthrough to get().
Resolve merge conflict in internal/config/config.go: adopt main's
refactored provider API (p.GetX exported methods) while preserving
our peer service and span attribute schema migrations. Update
reportTelemetry calls to configtelemetry.Report to match main's
rename.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rvice

# Conflicts:
#	internal/config/config_helpers.go
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… map

Avoid a breaking API change in this PR. The TracerConf cleanup
(removing PeerServiceMappings entirely) will be handled in a follow-up PR.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@funyjane funyjane requested review from a team as code owners April 10, 2026 14:18
@funyjane funyjane changed the title Config revamp/peer service feat(config): peer service revamp Apr 10, 2026
@datadog-official
Copy link
Copy Markdown
Contributor

datadog-official bot commented Apr 10, 2026

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 50.79%
Overall Coverage: 60.08% (-0.03%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: e62b453 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

@funyjane funyjane changed the title feat(config): peer service revamp refactor(config): peer service revamp Apr 10, 2026
@pr-commenter
Copy link
Copy Markdown

pr-commenter bot commented Apr 10, 2026

Benchmarks

Benchmark execution time: 2026-04-10 14:46:13

Comparing candidate commit e62b453 in PR branch config-revamp/peer-service with baseline commit 747b2e5 in branch main.

Found 0 performance improvements and 3 performance regressions! Performance is the same for 212 metrics, 9 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 ----------------------------------'

scenario:BenchmarkPayloadVersions/simple_1000spans/v0_4-25

  • 🟥 execution_time [+16.949µs; +17.461µs] or [+7.871%; +8.109%]

scenario:BenchmarkPayloadVersions/simple_100spans/v0_4-25

  • 🟥 execution_time [+1.625µs; +1.727µs] or [+6.603%; +7.016%]

scenario:BenchmarkPayloadVersions/simple_10spans/v0_4-25

  • 🟥 execution_time [+115.357ns; +125.043ns] or [+3.736%; +4.050%]

Copy link
Copy Markdown
Contributor

@hannahkm hannahkm left a comment

Choose a reason for hiding this comment

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

🚀

@funyjane funyjane merged commit 0029919 into main Apr 10, 2026
298 of 306 checks passed
@funyjane funyjane deleted the config-revamp/peer-service branch April 10, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants