agent_data_plane_config/control.rs
1//! Topology gates, orchestration decisions and application configuration.
2//!
3//! `ControlConfiguration` is read only by config-system and the topology builder, not by
4//! components. It carries pipeline activation gates, topology-shaping decisions, listen addresses,
5//! logging (read before topology exists), bootstrap IPC parameters, and process-lifecycle knobs.
6
7use serde::Serialize;
8
9/// A network listen address (for example, `tcp://127.0.0.1:5000`, `unix:///var/run/dsd.sock`).
10///
11/// Held as the source string; the orchestration layer parses it when binding. Source-agnostic and
12/// `Default`-able (unlike `std::net::SocketAddr`), so the model can derive `Default`.
13#[derive(Clone, Debug, Default, PartialEq, Serialize)]
14pub struct ListenAddress(pub String);
15
16/// Topology gates and orchestration decisions. Static for the process lifetime.
17#[derive(Clone, Debug, Default, PartialEq, Serialize)]
18pub struct ControlConfiguration {
19 /// Master switch for the whole data plane; when false, no pipelines are built.
20 pub enabled: bool,
21
22 /// Whether the DogStatsD metrics pipeline is built.
23 pub dogstatsd: bool,
24
25 /// Whether the checks metrics pipeline is built. (not in Datadog Agent config schema)
26 pub checks: bool,
27
28 /// Whether the OTLP pipeline is built.
29 pub otlp: bool,
30
31 /// Whether standalone mode is active, running without a core Agent. (not in Datadog Agent
32 /// config schema)
33 pub standalone_mode: bool,
34
35 /// Whether the process registers itself with the core Agent as a remote agent.
36 pub remote_agent_enabled: bool,
37
38 /// Whether to subscribe to core Agent configuration updates over the newer config-stream
39 /// endpoint.
40 pub use_new_config_stream_endpoint: bool,
41
42 /// Address the unsecured control API listens on.
43 pub api_listen_address: ListenAddress,
44
45 /// Address the TLS-secured control API listens on.
46 pub secure_api_listen_address: ListenAddress,
47
48 /// Logging configuration, read before runtime authority exists.
49 pub logging: Logging,
50
51 /// Bootstrap IPC and remote-agent connection parameters.
52 pub ipc: ControlIpc,
53
54 /// Grace period, in seconds, the aggregator is given to flush before shutdown.
55 pub aggregator_stop_timeout: u64,
56
57 /// Grace period, in seconds, for the whole topology to shut down. (not in Datadog Agent config
58 /// schema)
59 pub stop_timeout: u64,
60
61 /// Process memory ceiling, in bytes. (not in Datadog Agent config schema)
62 pub memory_limit: u64,
63
64 /// Fraction of the memory limit held back as headroom during memory accounting. (not in Datadog
65 /// Agent config schema)
66 pub memory_slop_factor: f64,
67}
68
69impl ControlConfiguration {
70 /// Derived decision the topology builder reads. The outbound Datadog forwarder is needed only
71 /// if some pipeline that emits to Datadog is enabled.
72 pub fn requires_datadog_forwarder(&self) -> bool {
73 self.dogstatsd || self.checks || self.otlp
74 }
75}
76
77/// Logging configuration, read before runtime authority exists.
78#[derive(Clone, Debug, Default, PartialEq, Serialize)]
79pub struct Logging {
80 /// Minimum severity a record must reach to be emitted.
81 pub level: String,
82
83 /// Whether log timestamps are formatted as RFC 3339.
84 pub format_rfc3339: bool,
85
86 /// Whether log records are emitted as JSON.
87 pub format_json: bool,
88
89 /// Whether logs are written to the console.
90 pub to_console: bool,
91
92 /// Whether logs are forwarded to syslog.
93 pub to_syslog: bool,
94
95 /// Whether syslog messages use the RFC 5424 framing.
96 pub syslog_rfc: bool,
97
98 /// Destination URI for syslog forwarding.
99 pub syslog_uri: String,
100
101 /// Path of the log file.
102 pub file: String,
103
104 /// Whether file logging is turned off entirely.
105 pub disable_file_logging: bool,
106
107 /// Number of rotated log files retained.
108 pub file_max_rolls: usize,
109
110 /// Maximum size, in bytes, a log file reaches before it is rotated.
111 pub file_max_size: u64,
112}
113
114/// Bootstrap IPC and remote-agent connection parameters, read before runtime authority exists.
115#[derive(Clone, Debug, Default, PartialEq, Serialize)]
116pub struct ControlIpc {
117 /// TCP port the command API listens on.
118 pub cmd_port: u16,
119
120 /// vsock address used for guest/host IPC.
121 pub vsock_addr: String,
122
123 /// Maximum gRPC message size, in bytes, accepted over the remote-agent IPC channel.
124 pub grpc_max_message_size: i64,
125
126 /// Timeout for establishing a connection to the container runtime interface.
127 pub cri_connection_timeout: i64,
128
129 /// Timeout for a single container runtime interface query.
130 pub cri_query_timeout: i64,
131
132 /// Byte budget for the remote-agent IPC string interner. (not in Datadog Agent config schema)
133 pub remote_agent_string_interner_size_bytes: usize,
134}