use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct ObservabilityConfig {
pub tracing_enabled: bool,
pub log_level: String,
pub otlp_endpoint: Option<String>,
pub service_name: String,
pub logging: LoggingConfig,
}
impl Default for ObservabilityConfig {
fn default() -> Self {
Self {
tracing_enabled: true,
log_level: "info".to_string(),
otlp_endpoint: None,
service_name: "backbone-app".to_string(),
logging: LoggingConfig::default(),
}
}
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct LoggingConfig {
pub json_format: bool,
pub include_timestamp: bool,
pub include_hostname: bool,
pub include_spans: bool,
pub extract_fields: Vec<String>,
pub buffer_size: usize,
}
impl Default for LoggingConfig {
fn default() -> Self {
Self {
json_format: true,
include_timestamp: true,
include_hostname: true,
include_spans: true,
extract_fields: vec![
"user_id".to_string(),
"request_id".to_string(),
"module".to_string(),
"action".to_string(),
],
buffer_size: 1000,
}
}
}
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct MetricsConfig {
pub enabled: bool,
pub exporter: MetricsExporterType,
pub port: u16,
}
impl Default for MetricsConfig {
fn default() -> Self {
Self {
enabled: false,
exporter: MetricsExporterType::Stdout,
port: 9090,
}
}
}
#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum MetricsExporterType {
Stdout,
Prometheus,
}