1 feat: support Remote Config sampling rules by dmehala · Pull Request #116 · DataDog/dd-trace-cpp · GitHub
Skip to content

feat: support Remote Config sampling rules#116

Merged
dmehala merged 11 commits intomainfrom
dmehala/support-rc-sampling-rules
May 23, 2024
Merged

feat: support Remote Config sampling rules#116
dmehala merged 11 commits intomainfrom
dmehala/support-rc-sampling-rules

Conversation

@dmehala
Copy link
Copy Markdown
Contributor

@dmehala dmehala commented Apr 29, 2024

This pull request introduces support for remote configuration sampling rules. With this enhancement, users can dynamically adjust sampling rates and rules without redeploying or restarting their applications, providing flexibility and control over ingestion cost.

@dmehala dmehala marked this pull request as ready for review May 15, 2024 13:53
@dmehala dmehala requested a review from a team as a code owner May 15, 2024 13:53
@dmehala dmehala requested review from pablomartinezbernardo and removed request for a team May 15, 2024 13:53
Copy link
Copy Markdown
Contributor

@pablomartinezbernardo pablomartinezbernardo left a comment

Choose a reason for hiding this comment

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

One small comment, otherwise LGTM

if (auto error = maybe_rules.if_error()) {
trace_sampling_rules_metadata.error = std::move(*error);
} else {
rules.merge(*maybe_rules);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm looking at the docs for this and if I'm understanding correctly, items already in rules will not be overriden by those in maybe_rules. Is that the intended behavior?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nope, good catch.

Comment thread src/datadog/config_manager.cpp
@dmehala dmehala force-pushed the dmehala/support-rc-sampling-rules branch from bdf01a0 to f26dd83 Compare May 22, 2024 17:39
@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented May 22, 2024

Benchmarks

Benchmark execution time: 2024-05-23 15:29:15

Comparing candidate commit 3df7c9f in PR branch dmehala/support-rc-sampling-rules with baseline commit de92b21 in branch dmehala/fix-rc-env-var.

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

dmehala added 9 commits May 22, 2024 21:46
According to the Remote Configuration specification,
`DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS` support floating point input
and can be set to `0`.
Now, sampling remote configuration do not create a new trace sampler
which has the side effect to reset the rate limiter.
- report remote trace sample rate as RULE instead of REMOTE_RULE for legacy reasons
- update REMOTE_RULES and REMOTE_ADAPTIVE_RULE values to match the spec
- report default sample rate for telemetry
- add _dd.psr for new remote rules
@dmehala dmehala force-pushed the dmehala/support-rc-sampling-rules branch from 05c0459 to 23bb27c Compare May 23, 2024 09:27
@dmehala dmehala changed the base branch from main to dmehala/fix-rc-env-var May 23, 2024 09:27
@dmehala
Copy link
Copy Markdown
Contributor Author

dmehala commented May 23, 2024

@pablomartinezbernardo

Since your review I added 3 commits:

I fixed the rule override issue you mentioned but also remote configuration system tests revealed part of the implementation I overlooked.

Comment on lines +19 to +24
auto j = r.to_json();
j["sample_rate"] = r.sample_rate;
if (r.max_per_second) {
j["max_per_second"] = *r.max_per_second;
}
res.emplace_back(std::move(j));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Curious to know, as they are being set in to_json, why is it necessary to set them again?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

to_json is not overloaded by SpanSamplerConfig::Rule, meaning SpanMatcher::to_json is called instead.

Comment thread src/datadog/trace_sampler_config.cpp Outdated
Base automatically changed from dmehala/fix-rc-env-var to main May 23, 2024 15:40
@dmehala dmehala merged commit 0ada79d into main May 23, 2024
@dmehala dmehala deleted the dmehala/support-rc-sampling-rules branch May 23, 2024 16:41
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.

2 participants