saluki_components/config_registry/datadog/
mod.rs1pub mod aggregate;
4pub mod dogstatsd;
5pub mod dogstatsd_mapper;
6pub mod dogstatsd_prefix_filter;
7pub mod encoders;
8pub mod forwarder;
9pub mod otlp;
10pub mod proxy;
11pub mod trace_obfuscation;
12
13use std::sync::LazyLock;
14
15use super::{ConfigKey, SalukiAnnotation};
16
17pub static ALL_ANNOTATIONS: LazyLock<Vec<&'static SalukiAnnotation>> = LazyLock::new(|| {
22 let mut v = Vec::new();
23 v.extend_from_slice(aggregate::ALL);
24 v.extend_from_slice(dogstatsd::ALL);
25 v.extend_from_slice(dogstatsd_mapper::ALL);
26 v.extend_from_slice(forwarder::ALL);
27 v.extend_from_slice(dogstatsd_prefix_filter::ALL);
28 v.extend_from_slice(encoders::ALL);
29 v.extend_from_slice(otlp::ALL);
30 v.extend_from_slice(proxy::ALL);
31 v.extend_from_slice(trace_obfuscation::ALL);
32 v
33});
34
35pub static ALL_KEYS: LazyLock<Vec<ConfigKey>> =
39 LazyLock::new(|| ALL_ANNOTATIONS.iter().map(|a| ConfigKey::from(*a)).collect());
40
41#[cfg(test)]
42mod registry_tests {
43 use super::*;
44 use crate::config_registry::SupportLevel;
45
46 #[test]
47 fn annotation_invariants() {
48 for annotation in ALL_ANNOTATIONS.iter() {
49 let path = annotation.yaml_path();
50 match annotation.support_level {
51 SupportLevel::Full | SupportLevel::Partial => {
52 assert!(
53 !annotation.used_by.is_empty(),
54 "annotation '{}' has support level {:?} but used_by is empty — \
55 add the consuming struct name(s) to used_by, or change the support level",
56 path,
57 annotation.support_level,
58 );
59 }
60 SupportLevel::Incompatible => {
61 assert!(
62 annotation.used_by.is_empty(),
63 "annotation '{}' has support level Incompatible but used_by is not empty — \
64 remove the struct name(s) from used_by, or change the support level",
65 path,
66 );
67 }
68 SupportLevel::Ignored => {
69 panic!(
70 "annotation '{}' has support level Ignored — \
71 Ignored is reserved for unannotated schema keys and must not appear \
72 in a hand-written SalukiAnnotation",
73 path,
74 );
75 }
76 }
77 }
78 }
79}