Skip to content
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

feat: support Remote Config sampling rules #116

Merged
merged 11 commits into from May 23, 2024

Conversation

dmehala
Copy link
Collaborator

@dmehala dmehala commented Apr 29, 2024

No description provided.

@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

@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);

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
Collaborator Author

Choose a reason for hiding this comment

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

Nope, good catch.

@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

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.

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
Collaborator 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));

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
Collaborator 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.

src/datadog/trace_sampler_config.cpp Outdated Show resolved Hide resolved
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
20 checks passed
@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.

None yet

2 participants