fix(config): normalize duration defaults to nanoseconds in classifier codegen [alt approach]#1959
fix(config): normalize duration defaults to nanoseconds in classifier codegen [alt approach]#1959jszwedko wants to merge 1 commit into
Conversation
… codegen The config classifier compares a key's incoming value against its schema default using exact JSON equality. Duration keys broke this: the schema default is a Go duration string (e.g. `10s`) while the Datadog Agent transmits durations over the config stream as integer nanoseconds, so a value at its default (e.g. `tls_handshake_timeout` = 10000000000) never matched and was flagged as an override, emitting a spurious "Unsupported configuration key" warning. Normalize `format: duration` defaults to integer nanoseconds at codegen time so the generated classifier default is stored in the same encoding the Agent sends. The runtime comparison stays a plain equality check. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
Binary Size Analysis (Agent Data Plane)Baseline: 4b4f85a · Comparison: a700cae · diff ✅ Binary size difference within thresholdChanges by Module
Detailed Symbol Changes |
| /// Supports the unit suffixes Go's `time.ParseDuration` accepts (`ns`, `us`/`µs`/`μs`, `ms`, `s`, | ||
| /// `m`, `h`), an optional leading sign, and fractional components. Returns `None` if the string is | ||
| /// not a well-formed duration. | ||
| fn parse_go_duration_nanos(input: &str) -> Option<i128> { |
There was a problem hiding this comment.
This can be refactored out to share the implementation from saluki-config.
Regression Detector (Agent Data Plane)Run ID: Optimization Goals: ✅ No significant changes detectedFine details of change detection per experiment (5)Experiments configured
Bounds Checks: ✅ Passed (5)
ExplanationA change is flagged as a regression when |Δ mean %| > 5.00% in the regressing direction for its optimization goal AND SMP marks the experiment as a regression ( |
There was a problem hiding this comment.
I think this is the inferior approach because it fixes the problem downstream of where the problem exists. While it's true that, currently, this may be the only downstream effect of the underspecified schema typing, we can't rely on that always being true and I think we should instead fix it at the source, more along the lines of #1958 (but I think that could be done differently and will comment over there next)
|
Closing in-lieu of #1958 |
Summary
Same fix as #1958, different implementation. The nightly integration suite started failing because ADP emitted a spurious
Unsupported configuration keywarning fortls_handshake_timeout. The root cause: the classifier stores schema defaults as JSON literals and compares them against Agent-supplied values with exact equality — but duration keys don't survive that comparison because the schema expresses their default as a Go duration string (10s) while the Agent transmits durations as integer nanoseconds (10000000000). This approach fixes it by normalizing duration defaults to nanoseconds at codegen time, so the generated classifier entry for a duration key holds an integer literal that directly matches what the Agent sends. The runtime comparison stays a plain equality check with no added logic.Companion to #1958 (runtime duration-aware compare) for design comparison.
schema_gen.rs(build-time)classifier.rs(runtime)ClassifierEntrychangesis_duration: bool10000000000(ns integer)"10s"(Go string, unchanged)Test plan
schema_gen.rs: Go duration parser covers all common forms (10s,500ms,1h30m0s,1.5h,250µs, bare0, negative, and malformed input).classifier.rs: duration key sent as nanoseconds is recognized as its default; non-default nanosecond value is not.adp-config-check-no-warnandadp-config-streampass locally againstagent-dev:master-py3-full.🤖 Generated with Claude Code