-
Notifications
You must be signed in to change notification settings - Fork 16
feat(stable_config): add >100mb check for stable config files #1432
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
BenchmarksComparisonBenchmark execution time: 2026-01-07 13:28:18 Comparing candidate commit 23c5263 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 57 metrics, 2 unstable metrics. CandidateCandidate benchmark detailsGroup 1
Group 2
Group 3
Group 4
Group 5
Group 6
Group 7
Group 8
Group 9
Group 10
Group 11
Group 12
Group 13
Group 14
Group 15
Group 16
Group 17
Group 18
Group 19
BaselineOmitted due to size. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1432 +/- ##
==========================================
+ Coverage 71.23% 71.25% +0.01%
==========================================
Files 411 411
Lines 65788 65863 +75
==========================================
+ Hits 46863 46929 +66
- Misses 18925 18934 +9
🚀 New features to boost your workflow:
|
b226e19 to
23c5263
Compare
| if metadata.len() > 1024 * 1024 * 100 { | ||
| let anyhow_error = anyhow::anyhow!("Local file is too large (> 100mb)"); | ||
| let logged_result = LoggedResult::Err(anyhow_error); | ||
| return logged_result; |
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.
is it by design that if one of them is too large, we bail out of stable config completely?
NIT: also was wondering if this check could be in a separate function which both local and fleet could reuse but not a big deal
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.
if one of them is too large, we bail out of stable config completely
If I remember correctly, we discussed this limitation a few months ago. For libraries that do not embed libdatadog for stable config -- like java and go -- we can attempt to open each file individually, and handle errors separately. It's my understanding that, in the libdatadog architecture, if either file is too big, we return a single error, and when the library consumes this error, it bails. Hence the behavior you described above. Correct?
And to my memory, we said there isn't a clean way to separate the error handling right now without breaking APIs, yes?
I really don't like this solution, since both inputs will have very different user experiences and thus should be logically separated, but I also acknowledge if it's the best we can do right now. In this case, can we add a comment in here that references a jira card that describes the issue behavior as well as how we might fix it in the future?
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 think it wouldn't be a problem to return a config without the keys from the faulty file, and just add the validation error to the messages of LoggedResult. We could extend LoggedResult to contain error_messages and add the >100 mb error message in this vector. The tracers should read this vector always, and if they see it's filled up, log it as an error, so that it appears in error tracking as well. We just fill the error_messages, dont interrupt the function and just return an Ok() with whichever configs were read.
If no file could be read at all(very rare...), I guess we could reallyl return an Error..
| }, | ||
| ); | ||
| match result { | ||
| LoggedResult::Ok(..) => panic!("Expected error"), |
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.
| LoggedResult::Ok(..) => panic!("Expected error"), | |
| LoggedResult::Ok(..) => panic!("Expected error for fleet file > 100mb, but got success instead"), |
What does this PR do?
This PR adds a check for stable config files >100mb and returns an error if it goes above that limit.
Motivation
Enforcing a limit at all provides value by protecting against extreme or clearly invalid file inputs
Additional Notes
The intentionally high limit is designed to minimize the risk of customers inadvertently hitting the cap and losing configuration silently. Under normal conditions, configuration files should remain well below this threshold
How to test the change?
Tests have been added