-
Notifications
You must be signed in to change notification settings - Fork 15
fix(config visibility): fix system test related to reporting of trace sampler and span sampler #272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
BenchmarksBenchmark execution time: 2026-01-07 13:46:24 Comparing candidate commit 5dec43d in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 1 metrics, 0 unstable metrics. |
|
🎯 Code Coverage 🔗 Commit SHA: 5dec43d | Docs | Datadog PR Page | Was this helpful? Give us feedback! |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
047a5b5 to
28c4f6d
Compare
dmehala
left a comment
There was a problem hiding this 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.
src/datadog/tracer_config.cpp
Outdated
| if (auto trace_sampler_config = | ||
| finalize_config(user_config.trace_sampler, &all_sources_configs)) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
46f073e to
7e00b6a
Compare
7e00b6a to
e681579
Compare
e681579 to
210bb3e
Compare
210bb3e to
5dec43d
Compare
dmehala
left a comment
There was a problem hiding this 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; |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)) { |
There was a problem hiding this comment.
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?
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