-
Notifications
You must be signed in to change notification settings - Fork 13
[APMSP-1976] Add check of parsed config and return action needed for tracer flare #1085
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: 2025-06-06 10:09:13 Comparing candidate commit 26e5ac3 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 52 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
BaselineOmitted due to size. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1085 +/- ##
==========================================
+ Coverage 70.94% 70.95% +0.01%
==========================================
Files 334 334
Lines 50549 50584 +35
==========================================
+ Hits 35860 35893 +33
- Misses 14689 14691 +2
🚀 New features to boost your workflow:
|
Artifact Size Benchmark Reportaarch64-alpine-linux-musl
aarch64-unknown-linux-gnu
libdatadog-x64-windows
libdatadog-x86-windows
x86_64-alpine-linux-musl
x86_64-unknown-linux-gnu
|
@@ -186,6 +219,7 @@ pub async fn run_remote_config_listener( | |||
Change::Add(file) => { | |||
println!("Added file: {} (version: {})", file.path(), file.version()); |
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.
Not sure if I asked this on a previous PR, but why are we printing to stdout here?
/// * `Ok(ReturnAction::Stop)` - If AGENT_TASK with the right properties. | ||
/// * `Ok(ReturnAction::None)` - Else. | ||
/// * `FlareError(msg)` - If something fail. | ||
pub fn check_remote_config_file(file: RemoteConfigFile) -> Result<ReturnAction, FlareError> { |
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 this function covered by tests somewhere else? If not, anything preventing us from adding some?
datadog-tracer-flare/src/lib.rs
Outdated
"error" => ReturnAction::StartError, | ||
"critical" => ReturnAction::StartCritical, | ||
"off" => ReturnAction::StartOff, | ||
_ => ReturnAction::None, |
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 we get an unknown log level is just setting it to None the appropriate action? Or should it be an 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.
I think an error would be the most appropriate. But it could be nice to launch the flare still with a default level.
Co-authored-by: Edmund Kump <[email protected]>
datadog-tracer-flare/src/lib.rs
Outdated
StartTrace = 0, | ||
StartDebug = 1, | ||
StartInfo = 2, | ||
StartWarn = 3, | ||
StartError = 4, | ||
StartCritical = 5, | ||
StartOff = 6, |
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.
Any reason to use explicit discriminants here ?
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 would add the crate to the .codecov file so we can the code coverage report.
@@ -23,19 +23,22 @@ pub enum FlareError { | |||
NoFlare(String), | |||
/// Listening to the RemoteConfig failed. | |||
ListeningError(String), | |||
/// Parsing of config failed. | |||
ParsingError(String), |
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.
It might be beneficial to implement Error
trait for FlareError
.
What does this PR do?
This PR add a function that check the config received by the listener of RemoteConfig. This way it returns, through an enum, which action have to be done by the tracer flare depending of the config.
Motivation
What inspired you to submit this pull request?
Additional Notes
Also I updated the CODEOWNER file because of the crate
datadog-dynamic-configuration
was remove in my previous PR.How to test the change?
Describe here in detail how the change can be validated.