fix(observability): support verbose backend selection (#3374)
Co-authored-by: argenis de la rosa <theonlyhennygod@gmail.com>
This commit is contained in:
parent
a606f308f5
commit
bbc82fd4f9
@ -2254,7 +2254,7 @@ impl Default for MemoryConfig {
|
||||
/// Observability backend configuration (`[observability]` section).
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
|
||||
pub struct ObservabilityConfig {
|
||||
/// "none" | "log" | "prometheus" | "otel"
|
||||
/// "none" | "log" | "verbose" | "prometheus" | "otel"
|
||||
pub backend: String,
|
||||
|
||||
/// OTLP endpoint (e.g. "http://localhost:4318"). Only used when backend = "otel".
|
||||
|
||||
@ -28,6 +28,7 @@ use crate::config::ObservabilityConfig;
|
||||
pub fn create_observer(config: &ObservabilityConfig) -> Box<dyn Observer> {
|
||||
match config.backend.as_str() {
|
||||
"log" => Box::new(LogObserver::new()),
|
||||
"verbose" => Box::new(VerboseObserver::new()),
|
||||
"prometheus" => {
|
||||
#[cfg(feature = "observability-prometheus")]
|
||||
{
|
||||
@ -112,6 +113,15 @@ mod tests {
|
||||
assert_eq!(create_observer(&cfg).name(), "log");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn factory_verbose_returns_verbose() {
|
||||
let cfg = ObservabilityConfig {
|
||||
backend: "verbose".into(),
|
||||
..ObservabilityConfig::default()
|
||||
};
|
||||
assert_eq!(create_observer(&cfg).name(), "verbose");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn factory_prometheus_returns_prometheus() {
|
||||
let cfg = ObservabilityConfig {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user