feagi_observability/
config.rs1use serde::{Deserialize, Serialize};
7use std::path::PathBuf;
8
9#[derive(Debug, Clone, Serialize, Deserialize)]
11pub struct ObservabilityConfig {
12 pub logging: LoggingConfig,
13 pub telemetry: TelemetryConfig,
14 pub profiling: ProfilingConfig,
15}
16
17#[derive(Debug, Clone, Serialize, Deserialize)]
19pub struct LoggingConfig {
20 pub level: String,
22
23 pub format: LogFormat,
25
26 pub output: LogOutput,
28
29 pub file_path: Option<PathBuf>,
31}
32
33#[derive(Debug, Clone, Serialize, Deserialize)]
35pub enum LogFormat {
36 Text,
37 Json,
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize)]
42pub enum LogOutput {
43 Stdout,
44 File(String),
45 Syslog,
46}
47
48#[derive(Debug, Clone, Serialize, Deserialize)]
50pub struct TelemetryConfig {
51 pub metrics_enabled: bool,
53
54 pub tracing_enabled: bool,
56
57 pub tracing_endpoint: Option<String>,
59
60 pub metrics_path: String,
62
63 pub health_check_path: String,
65
66 pub system_metrics_interval: u64,
68}
69
70#[derive(Debug, Clone, Serialize, Deserialize)]
72pub struct ProfilingConfig {
73 pub cpu_profiling: bool,
75
76 pub memory_profiling: bool,
78
79 pub output_dir: PathBuf,
81
82 pub sample_rate: f64,
84
85 pub chrome_tracing: bool,
87
88 pub perf_profiling: bool,
90}
91
92impl Default for ObservabilityConfig {
93 fn default() -> Self {
94 ObservabilityConfig {
95 logging: LoggingConfig {
96 level: "info".to_string(),
97 format: LogFormat::Text,
98 output: LogOutput::Stdout,
99 file_path: None,
100 },
101 telemetry: TelemetryConfig {
102 metrics_enabled: true,
103 tracing_enabled: false,
104 tracing_endpoint: None,
105 metrics_path: "/metrics".to_string(),
106 health_check_path: "/health".to_string(),
107 system_metrics_interval: 5,
108 },
109 profiling: ProfilingConfig {
110 cpu_profiling: false,
111 memory_profiling: false,
112 output_dir: PathBuf::from("./profiles"),
113 sample_rate: 1.0,
114 chrome_tracing: false,
115 perf_profiling: false,
116 },
117 }
118 }
119}
120
121impl Default for LoggingConfig {
122 fn default() -> Self {
123 LoggingConfig {
124 level: "info".to_string(),
125 format: LogFormat::Text,
126 output: LogOutput::Stdout,
127 file_path: None,
128 }
129 }
130}
131
132impl Default for TelemetryConfig {
133 fn default() -> Self {
134 TelemetryConfig {
135 metrics_enabled: true,
136 tracing_enabled: false,
137 tracing_endpoint: None,
138 metrics_path: "/metrics".to_string(),
139 health_check_path: "/health".to_string(),
140 system_metrics_interval: 5,
141 }
142 }
143}
144
145impl Default for ProfilingConfig {
146 fn default() -> Self {
147 ProfilingConfig {
148 cpu_profiling: false,
149 memory_profiling: false,
150 output_dir: PathBuf::from("./profiles"),
151 sample_rate: 1.0,
152 chrome_tracing: false,
153 perf_profiling: false,
154 }
155 }
156}