Repository navigation
Conversation
The remote config client dispatches only the configs that changed since the last poll, but APMTracingCallback rebuilt its config map from each call's payloads alone. Any dispatch that did not include the config carrying tracing_sampling_rules (another service's config, a removal) merged to a lib_config without rules, which reset the remote sampling rules to the default "" and logged "Failed to apply all sampling rules. Rules=, Applied=[]". Keep the active configs on the callback instance, drop configs that are removed or retargeted away from this service/env, and treat an empty sampling rules value as "no rules" instead of invalid JSON. Fixes DataDog#20871 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
| sampling_rules = [] | ||
| if not rules or not rules.strip(): | ||
| # An empty value means no rules, e.g. after remote configuration unsets them. | ||
| self.rules = sampling_rules |
There was a problem hiding this comment.
Why not apply the same sorting logic used on L170?
There was a problem hiding this comment.
Good point, done in e0d1ed5: the empty value now skips only the JSON parsing and falls through to the same sorted(...) assignment as every other path, so there's no separate early return. Behavior is unchanged (an empty value still yields self.rules == [] without logging an error), and the existing test covers it.
… path Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
More details
Empty sampling-rule values clear the rules without attempting JSON parsing and retain the shared sorting and assignment path. The static specialist reported no actionable regressions in the supplied diff.
🤖 Bits Code Review · Commit e88365a
mabdinur
left a comment
There was a problem hiding this comment.
Reviewed the current revision. Empty values use the shared rule-processing path, and the regression test covers clearing existing rules without logging errors. All 234 sampler tests and lint checks pass locally.
❌ ErrorsYour PR has failed checks. Please review the issues below and take necessary action before merging. 🚦 2 Pipeline jobs failed
Useful? React with 👍 / 👎 This comment will be updated automatically if new data arrives.🔗 Commit SHA: a5fff67 | Docs | View more details | Give us feedback! |
Skip JSON decoding when remote sampling rules are unset. Reuse the existing rule processing path and cover empty strings and empty JSON lists with a parameterized regression test. Keep the active remote configuration handling already present on main.
Describe the remaining sampling rule removal error in a separate commit so changelog history can be scanned correctly.
e88365a to
a5fff67
Compare
There was a problem hiding this comment.
More details
Empty sampling-rule values now bypass JSON decoding and use the shared rule-processing path, clearing existing rules without the erroneous parsing log. The completed static review found no actionable defects.
🤖 Bits Code Review · Commit a5fff67
Description
When Remote Configuration removes trace sampling rules and no local rules are configured, the sampler receives an empty string and logs
Failed to apply all sampling ruleswhile clearing the rules.Treat the empty string as an empty rule list before the existing processing loop. This skips JSON decoding for an unset value and keeps the shared validation and sorting path. Addresses the remaining error-log case in #20871.
Customer impact
Removing remote trace sampling rules restores default sampling without an erroneous JSON parsing error in application logs.
Testing
scripts/run-tests.scripts/lint checkspasses.Tests ran locally on macOS using released native dependencies and a local APM test Agent. The Docker run was blocked by storage I/O errors.
Risks
Low. Nonempty input retains its existing JSON validation, partial-rule handling, and precedence ordering.
Additional Notes
Active remote configuration retention is already fixed by #21208. This update keeps that implementation and its tests, and focuses on the remaining empty-rule error.
Closes: #22417