backbone_observability/
config.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Deserialize, Serialize)]
7pub struct ObservabilityConfig {
8 pub tracing_enabled: bool,
10
11 pub log_level: String,
13
14 pub otlp_endpoint: Option<String>,
16
17 pub service_name: String,
19
20 pub logging: LoggingConfig,
22}
23
24impl Default for ObservabilityConfig {
25 fn default() -> Self {
26 Self {
27 tracing_enabled: true,
28 log_level: "info".to_string(),
29 otlp_endpoint: None,
30 service_name: "backbone-app".to_string(),
31 logging: LoggingConfig::default(),
32 }
33 }
34}
35
36#[derive(Debug, Clone, Deserialize, Serialize)]
38pub struct LoggingConfig {
39 pub json_format: bool,
41
42 pub include_timestamp: bool,
44
45 pub include_hostname: bool,
47
48 pub include_spans: bool,
50
51 pub extract_fields: Vec<String>,
53
54 pub buffer_size: usize,
56}
57
58impl Default for LoggingConfig {
59 fn default() -> Self {
60 Self {
61 json_format: true,
62 include_timestamp: true,
63 include_hostname: true,
64 include_spans: true,
65 extract_fields: vec![
66 "user_id".to_string(),
67 "request_id".to_string(),
68 "module".to_string(),
69 "action".to_string(),
70 ],
71 buffer_size: 1000,
72 }
73 }
74}
75
76#[derive(Debug, Clone, Deserialize, Serialize)]
78pub struct MetricsConfig {
79 pub enabled: bool,
81
82 pub exporter: MetricsExporterType,
84
85 pub port: u16,
87}
88
89impl Default for MetricsConfig {
90 fn default() -> Self {
91 Self {
92 enabled: false,
93 exporter: MetricsExporterType::Stdout,
94 port: 9090,
95 }
96 }
97}
98
99#[derive(Debug, Clone, Deserialize, Serialize)]
101#[serde(rename_all = "lowercase")]
102pub enum MetricsExporterType {
103 Stdout,
105
106 Prometheus,
108}