Skip to content

Conversation

@anna-git
Copy link
Contributor

@anna-git anna-git commented Jan 5, 2026

Description

Previous PR #268 accidentally broke the system test library_settings as we're not filling the telemetry vector with final.metadata anymore but from a separate array and this array wasn't passed by to finalize_config for span and trace sampler.

Motivation

Fix system test Test_Environment::test_library_settings

Additional Notes

Ran parametric tests locally and they all pass. (I thought they did with the previous PR as well but turned out I had a cached docker image)

https://datadoghq.atlassian.net/browse/APMAPI-1784

@anna-git anna-git changed the title Config Visibility: fix reporting of trace sampler and span sampler Config Visibility: fix system test related to reporting of trace sampler and span sampler Jan 5, 2026
@pr-commenter
Copy link

pr-commenter bot commented Jan 5, 2026

Benchmarks

Benchmark execution time: 2026-01-07 13:46:24

Comparing candidate commit 5dec43d in PR branch anna/config-visibility-fix-sample-reporting with baseline commit ccc2a54 in branch main.

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

@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Jan 5, 2026

🎯 Code Coverage
Patch Coverage: 100.00%
Overall Coverage: 87.81% (-0.03%)

View detailed report

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 5dec43d | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@codecov-commenter
Copy link

codecov-commenter commented Jan 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.80%. Comparing base (ccc2a54) to head (5dec43d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #272      +/-   ##
==========================================
- Coverage   87.83%   87.80%   -0.03%     
==========================================
  Files          84       84              
  Lines        5664     5652      -12     
==========================================
- Hits         4975     4963      -12     
  Misses        689      689              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@anna-git anna-git force-pushed the anna/config-visibility-fix-sample-reporting branch from 047a5b5 to 28c4f6d Compare January 5, 2026 23:34
@anna-git anna-git marked this pull request as ready for review January 6, 2026 00:08
@anna-git anna-git requested a review from a team as a code owner January 6, 2026 00:08
@anna-git anna-git requested review from Anilm3 and removed request for a team January 6, 2026 00:08
@dmehala dmehala changed the title Config Visibility: fix system test related to reporting of trace sampler and span sampler fix(config visibility): fix system test related to reporting of trace sampler and span sampler Jan 6, 2026
Copy link
Collaborator

@dmehala dmehala left a comment

Choose a reason for hiding this comment

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

The fix works as intended. That said, it will be cleaner to populate all_sources_configs by merging the configuration sources from the trace and span samplers using the results of finalize_config, leveraging the same mechanism used for metadata. This would help keep the approach consistent and easier to maintain.

Comment on lines 424 to 425
if (auto trace_sampler_config =
finalize_config(user_config.trace_sampler, &all_sources_configs)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I prefer the current behaviour where the configuration source/data are returned by finalize_config, then merged into the final all_sources_configs. Instead of adding a superfluous argument to finalize_config.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point thank you, I got worried about creating a new hash table in these types, but in the end not changing signatures is definitely cleaner, I changed it in bcc8bd6

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also added a few more asserts in commit 5dec43d

Copy link
Collaborator

@dmehala dmehala left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my comments. I’ve left a few additional comments that still need to be addressed; aside from those, LGTM.

};

std::vector<Rule> rules;
std::unordered_map<ConfigName, ConfigMetadata> metadata;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since telemetry_configs already stores all versions, is this still necessary? If not, I recommend removing it and renaming telemetry_configs to metadata for clarity.

FinalizedSpanSamplerConfig result;

std::vector<SpanSamplerConfig::Rule> rules;
// Convert to Optional for resolve_and_record_config
Copy link
Collaborator

Choose a reason for hiding this comment

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

These comments don’t provide long-term value and are unlikely to remain accurate over time. Can we remove it?

// appended to the end of `rules`. First, though, we have to make sure the
// sample rate is valid.
if (sample_rate) {
if (sample_rate && (env_config->sample_rate || config.sample_rate)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I’m not sure I understand why this is required. Could you provide some context?

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.

4 participants