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