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/// Whether error traces are sampled independently of the base sampler by default.
95pub const DEFAULT_ERROR_SAMPLING_ENABLED: bool = true;
96
97/// Default rare-sampler traces-per-second budget.
98pub const DEFAULT_RARE_SAMPLER_TPS: f64 = 5.0;
99
100/// Default rare-sampler cooldown, in seconds.
101pub const DEFAULT_RARE_SAMPLER_COOLDOWN_SECS: f64 = 300.0;
102
103/// Default rare-sampler signature cardinality.
104pub const DEFAULT_RARE_SAMPLER_CARDINALITY: usize = 200;
105
106/// Default OTLP trace string interner capacity: 512 KiB.
107pub const DEFAULT_STRING_INTERNER_SIZE_BYTES: NonZeroUsize = NonZeroUsize::new(512 * 1024).unwrap();
108
109/// Maximum string interner capacity: 1 GiB. Arbitrary to stop @blt from blowing us up.
110pub const MAX_STRING_INTERNER_SIZE_BYTES: NonZeroUsize = NonZeroUsize::new(1024 * 1024 * 1024).unwrap();