Skip to content

Commit c558ea4

Browse files
authored
feature(agent-data-plane): add setting to gate registering as remote agent with Core Agent (#1091)
1 parent 4a0eba1 commit c558ea4

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

bin/agent-data-plane/src/config.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pub struct DataPlaneConfiguration {
99
enabled: bool,
1010
standalone_mode: bool,
1111
use_new_config_stream_endpoint: bool,
12+
remote_agent_enabled: bool,
1213
api_listen_address: ListenAddress,
1314
secure_api_listen_address: ListenAddress,
1415
telemetry_enabled: bool,
@@ -37,6 +38,9 @@ impl DataPlaneConfiguration {
3738
use_new_config_stream_endpoint: config
3839
.try_get_typed("data_plane.use_new_config_stream_endpoint")?
3940
.unwrap_or(false),
41+
remote_agent_enabled: config
42+
.try_get_typed("data_plane.remote_agent_enabled")?
43+
.unwrap_or(false),
4044
api_listen_address: config
4145
.try_get_typed("data_plane.api_listen_address")?
4246
.unwrap_or_else(|| ListenAddress::any_tcp(5100)),
@@ -67,6 +71,11 @@ impl DataPlaneConfiguration {
6771
self.use_new_config_stream_endpoint
6872
}
6973

74+
/// Returns `true` if the data plane should register as a remote agent.
75+
pub const fn remote_agent_enabled(&self) -> bool {
76+
self.remote_agent_enabled
77+
}
78+
7079
/// Returns a reference to the API listen address
7180
///
7281
/// This is also referred to as the "unprivileged" API.

bin/agent-data-plane/src/internal/control_plane.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async fn configure_and_spawn_api_endpoints(
9191
) -> Result<(), GenericError> {
9292
// When not in standalone mode, install the necessary components for registering ourselves with the Datadog Agent as
9393
// a "remote agent", which wires up ADP to allow the Datadog Agent to query it for status and flare information.
94-
if !dp_config.standalone_mode() {
94+
if !dp_config.standalone_mode() && dp_config.remote_agent_enabled() {
9595
let secure_api_grpc_target_addr =
9696
GrpcTargetAddress::try_from_listen_addr(dp_config.secure_api_listen_address()).ok_or_else(|| {
9797
generic_error!("Failed to get valid gRPC target address from secure API listen address.")
@@ -118,6 +118,7 @@ async fn configure_and_spawn_api_endpoints(
118118
// Each service is tracked automatically for registration with the Remote Agent Registry.
119119
privileged_api = privileged_api.with_grpc_service(remote_agent_config.create_status_service());
120120
privileged_api = privileged_api.with_grpc_service(remote_agent_config.create_flare_service());
121+
121122
// Only register the telemetry service if telemetry is enabled
122123
if dp_config.telemetry_enabled() {
123124
privileged_api = privileged_api.with_grpc_service(remote_agent_config.create_telemetry_service());

0 commit comments

Comments
 (0)