agent_data_plane_config/defaults.rs
1//! This is a place for re-usable Saluki-only defaults.
2//!
3//! Important: this is *not* a place where we should restate Datadog Agent schema-derived defaults.
4//! Defaults that flow from the Datadog schema are defined by codegen in the appropriate crate. We
5//! only want the definitive codegen defaults rather than restating values that can drift (see
6//! #1802).
7
8use std::{
9 num::{NonZeroU64, NonZeroUsize},
10 time::Duration,
11};
12
13/// Default internal telemetry verbosity.
14pub const DEFAULT_METRICS_LEVEL: &str = "info";
15
16/// Default memory-accounting slop factor.
17pub const DEFAULT_MEMORY_SLOP_FACTOR: f64 = 0.25;
18
19/// Default global memory limiter state.
20pub const DEFAULT_ENABLE_GLOBAL_LIMITER: bool = true;
21
22/// Default Checks IPC endpoint.
23pub const DEFAULT_CHECKS_IPC_ENDPOINT: &str = "tcp://0.0.0.0:5105";
24
25/// Default length of an aggregation window.
26pub const DEFAULT_AGGREGATE_WINDOW_DURATION_SECONDS: NonZeroU64 = NonZeroU64::new(10).unwrap();
27
28/// Default maximum number of contexts held per aggregation window.
29pub const DEFAULT_AGGREGATE_CONTEXT_LIMIT: usize = 1_000_000;
30
31/// Default period between aggregation flushes.
32pub const DEFAULT_AGGREGATE_FLUSH_INTERVAL: Duration = Duration::from_secs(15);
33
34/// Default delay before an idle passthrough buffer is flushed.
35pub const DEFAULT_AGGREGATE_PASSTHROUGH_IDLE_FLUSH_TIMEOUT: Duration = Duration::from_secs(1);
36
37/// Default byte capacity of the DogStatsD mapper's string interner.
38pub const DEFAULT_DOGSTATSD_MAPPER_STRING_INTERNER_SIZE_BYTES: NonZeroUsize = NonZeroUsize::new(64 * 1024).unwrap();
39
40/// Default remote-agent IPC string interner budget.
41pub const DEFAULT_REMOTE_AGENT_STRING_INTERNER_SIZE_BYTES: NonZeroUsize = NonZeroUsize::new(512 * 1024).unwrap();
42
43/// Default DogStatsD TCP listen port.
44///
45/// A value of `0` disables the TCP listener.
46pub const DEFAULT_DOGSTATSD_TCP_PORT: u16 = 0;
47
48/// Whether DogStatsD UDP listener autoscaling is enabled by default.
49pub const DEFAULT_DOGSTATSD_AUTOSCALE_UDP_LISTENERS: bool = false;
50
51/// Default number of DogStatsD packet receive buffers allocated at startup.
52pub const DEFAULT_DOGSTATSD_BUFFER_COUNT: usize = 128;
53
54/// Default ceiling on DogStatsD packet receive buffers.
55///
56/// 32768 buffers at the default 8 KiB buffer size provide 256 MiB of payload capacity.
57pub const DEFAULT_DOGSTATSD_BUFFER_COUNT_MAX: usize = 32_768;
58
59/// Whether the DogStatsD decoder relaxes its strictness by default.
60///
61/// Matches the Datadog Agent, which accepts payloads that violate the DogStatsD spec.
62pub const DEFAULT_DOGSTATSD_PERMISSIVE_DECODING: bool = true;
63
64/// Default maximum number of DogStatsD metric contexts held in the cache.
65pub const DEFAULT_DOGSTATSD_CACHED_CONTEXTS_LIMIT: usize = 500_000;
66
67/// Default maximum number of DogStatsD tagsets held in the cache.
68pub const DEFAULT_DOGSTATSD_CACHED_TAGSETS_LIMIT: usize = 500_000;
69
70/// Whether DogStatsD contexts may be heap-allocated when the string interner is full by default.
71pub const DEFAULT_DOGSTATSD_ALLOW_CONTEXT_HEAP_ALLOCS: bool = true;
72
73/// Default floor applied to DogStatsD metric sample rates, which is roughly 260M samples.
74///
75/// Sample rates below this floor are clamped, bounding how many equivalent samples a single metric
76/// can contribute.
77pub const DEFAULT_DOGSTATSD_MINIMUM_SAMPLE_RATE: f64 = 0.000000003845;
78
79/// Default timeout before a partially filled encoder payload is flushed.
80pub const DEFAULT_ENCODER_FLUSH_TIMEOUT: Duration = Duration::from_secs(2);
81
82/// Default zstd compression level for payloads ADP sends.
83///
84/// Higher than the Agent's default of `1` because ADP compresses more efficiently and can afford
85/// better compression: level 3 yields ~6% smaller payloads without a net CPU increase.
86pub const DEFAULT_ZSTD_COMPRESSOR_LEVEL: i32 = 3;
87
88/// Default maximum number of metrics packed into a single encoder payload.
89pub const DEFAULT_MAX_METRICS_PER_PAYLOAD: usize = 10_000;
90
91/// Default environment for traces that do not provide one.
92pub const DEFAULT_TRACE_ENV: &str = "none";
93
94/// Default maximum length of a span's resource name, in bytes (`apm_config.max_resource_len`).
95pub const DEFAULT_MAX_RESOURCE_LEN: usize = 5000;
96
97/// Whether error traces are sampled independently of the base sampler by default.
98pub const DEFAULT_ERROR_SAMPLING_ENABLED: bool = true;
99
100/// Default rare-sampler traces-per-second budget.
101pub const DEFAULT_RARE_SAMPLER_TPS: f64 = 5.0;
102
103/// Default rare-sampler cooldown, in seconds.
104pub const DEFAULT_RARE_SAMPLER_COOLDOWN_SECS: f64 = 300.0;
105
106/// Default rare-sampler signature cardinality.
107pub const DEFAULT_RARE_SAMPLER_CARDINALITY: usize = 200;
108
109/// Default OTLP trace string interner capacity: 512 KiB.
110pub const DEFAULT_STRING_INTERNER_SIZE_BYTES: NonZeroUsize = NonZeroUsize::new(512 * 1024).unwrap();
111
112/// Maximum string interner capacity: 1 GiB. Arbitrary to stop @blt from blowing us up.
113pub const MAX_STRING_INTERNER_SIZE_BYTES: NonZeroUsize = NonZeroUsize::new(1024 * 1024 * 1024).unwrap();
114
115/// Default TCP endpoint the APM v1.0 trace receiver listens on.
116///
117/// Adjacent to the trace-agent's `8126` so the side-by-side relationship is obvious, and
118/// deliberately not `8126` itself: the trace-agent keeps that port, and operators roll ADP back by
119/// pointing tracers at it again. Loopback-only, matching
120/// [`DEFAULT_APM_NON_LOCAL_TRAFFIC`]; a containerized deployment that needs to accept traffic from
121/// other containers must set both the endpoint and that gate.
122pub const DEFAULT_APM_RECEIVER_ENDPOINT: &str = "localhost:8127";
123
124/// Default maximum accepted v1.0 trace request body size, in bytes: 25 MB (26,214,400 bytes).
125///
126/// Matches `MaxRequestBytes` in the reference trace-agent, which `apm_config.max_payload_size` sets.
127/// This bounds the request body before any decoding, so raising it raises peak memory per in-flight
128/// request; high-volume tracers that batch aggressively may need a larger value, at that cost.
129pub const DEFAULT_APM_MAX_PAYLOAD_SIZE: usize = 25 * 1024 * 1024;
130
131/// Whether the APM v1.0 trace receiver accepts non-local traffic by default.
132///
133/// Defaults to `false`, so the receiver refuses to bind a non-loopback TCP address. Set this only
134/// when tracers run outside the host's network namespace and the port is not reachable from
135/// untrusted networks.
136pub const DEFAULT_APM_NON_LOCAL_TRAFFIC: bool = false;
137
138/// Default time the APM v1.0 trace receiver waits for the pipeline to accept a payload: 1 second.
139///
140/// Matches `DecoderTimeout` in the reference trace-agent (`apm_config.decoder_timeout`), which bounds
141/// the equivalent wait there. Once this elapses the receiver sheds the payload rather than holding
142/// the tracer's connection open: a saturated or wedged pipeline then costs the tracer one refused
143/// request instead of an indefinitely blocked one. Raise it to trade tracer-visible refusals for
144/// tolerance of longer downstream stalls; lower it to shed load sooner. A value of `0` refuses every
145/// payload the pipeline cannot accept instantly.
146pub const DEFAULT_APM_DISPATCH_TIMEOUT: Duration = Duration::from_secs(1);