-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add Live debugging & Remote Configuration #398
Conversation
67d1d75
to
6808d58
Compare
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.
Skimmed through the PR and have a few questions/comments:
First, are you handling agentless and if so why? It wasn't mandatory for the first implementation right? MVP FTW.
I don't understand well the sidecar code yet, but I assume there are some constants that should be attached to the session and taken from there. This could avoid passing this data around for new use cases (service name, env, version...)
Then, you could have made it easier on the reviewer by adding commits or separating into a few PRs. I assume it's because it's in draft, but you're missing a lot of tests. Doing the refacto must have been extra complicated without tests.
Very exciting work though, that opens a lot of doors. Thanks for doing it.
@@ -0,0 +1,23 @@ | |||
[package] |
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.
What's the size impact of having RC? Are all those dependencies already used in libdatadog?
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.
Only sha2 isn't. The fat ones, like tokio, serde, serde_json and hyper are used already in other packages than the sidecar too.
} | ||
|
||
/// Quite generic fetching implementation: | ||
/// - runs a request against the Remote Config Server, |
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 not going through the agent?
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.
Server as in "a remote endpoint which serves things" - might be datadog backend, might be agent. The datadog backend isn't supported yet. But it would eventually be handled here though.
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.
|
||
#[no_mangle] | ||
#[allow(clippy::missing_safety_doc)] | ||
pub unsafe extern "C" fn ddog_sidecar_set_remote_config_data( |
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 wonder if this should be orthogonal to RC.
Data used for RC could be used for dogstatsdclient, telemetry... So I assume they should be linked to a session more than to RC itself. This couples a bit things, but I think it simplifies the API
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.
Yes, it should be orthogonal.
remote-config/src/fetch/fetcher.rs
Outdated
|
||
const PROD_INTAKE_SUBDOMAIN: &str = "config"; | ||
|
||
/// Manages files. |
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.
Talking about files when referring to configurations can be misleading. It's a ConfigurationStore, replace the naming from file to config please
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 took the name from message File
from the proto definition. It's literally the contents of these File
messages, which are meant processed here.
type StoredFile; | ||
|
||
/// A new, currently unknown file was received. | ||
fn store(&self, version: u64, path: RemoteConfigPath, contents: Vec<u8>) -> anyhow::Result<Arc<Self::StoredFile>>; |
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 wouldn't make a distinction between the 2 calls, the store knows if it's already present or not, what's the different use case?
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.
Actually, the ConfigFileStorage impl in shm_remote_config.rs does not maintain it. The implementation is very straightforward there. It's done that way to avoid tracking state and expiration manually in the FileStorage implementations - that task is up to the ConfigFetcherState.
pub struct ConfigFetcher<S: FileStorage> { | ||
pub file_storage: S, | ||
state: Arc<ConfigFetcherState<S::StoredFile>>, | ||
timeout: AtomicU32, |
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.
unused?
} | ||
} | ||
|
||
pub trait RefcountedFile { |
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.
Can't this be achieved by using weak and strong references?
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.
No, using Weak references would imply that, once the fetchers no longer hold a reference to it, the underlying memory can no longer be accessed. This may not be desired; refcounting allows careful control of only relinquishing it from fetchers, without affecting live references.
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 give strong references to the shared clients and weak ones to everything else, so that it's self managed and doesn't have set
methods setting a counter
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.
nitpick - think of updating the codeowners for the new crates (remote-config
and live-debugger
). I assume common components could take ownership of the RC one.
9562b23
to
1470cc9
Compare
Signed-off-by: Bob Weinand <[email protected]>
Signed-off-by: Bob Weinand <[email protected]>
Signed-off-by: Bob Weinand <[email protected]>
Signed-off-by: Bob Weinand <[email protected]>
Signed-off-by: Bob Weinand <[email protected]>
1470cc9
to
568373c
Compare
Signed-off-by: Bob Weinand <[email protected]>
Closing this PR in favor of the other #488. |
Adding live debugging support. It requires remote configuration to work at all, so to do proper integration tests of the functionality, that part is also in this big PR.
Dynamic configuration is a small part, just 50 lines of code, describing the structures it contains.
As to more specific changes to current code:
&'a AsBytes<'a>
, while only&AsBytes<'a>
(independent lifetime) is required.General notes:
ConfigFetcher
should be enough, and for some theSharedFetcher
is needed. Fewest should actually need theMultiTargetFetcher
. A FFi interface hasn't been defined yet as it wasn't needed:TODOs:
timeout
inConfigFetcher
. Drop it, or do we need it? No idea.ddtags
sending for live debugger sender.ConfigFetcher
SharedFetcher
MultiTargetFetcher