mockforge_observability/
lib.rs1pub mod logging;
21pub mod prometheus;
22pub mod system_metrics;
23pub mod tracing_integration;
24
25pub use logging::{init_logging, init_logging_with_otel, LoggingConfig};
27pub use prometheus::{get_global_registry, MetricsRegistry};
28pub use system_metrics::{start_system_metrics_collector, SystemMetricsConfig};
29pub use tracing_integration::{init_with_otel, shutdown_otel, OtelTracingConfig};
30
31#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
33pub enum Protocol {
34 Http,
35 Grpc,
36 WebSocket,
37 GraphQL,
38}
39
40impl Protocol {
41 pub fn as_str(&self) -> &'static str {
42 match self {
43 Protocol::Http => "http",
44 Protocol::Grpc => "grpc",
45 Protocol::WebSocket => "websocket",
46 Protocol::GraphQL => "graphql",
47 }
48 }
49}
50
51impl std::fmt::Display for Protocol {
52 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
53 write!(f, "{}", self.as_str())
54 }
55}
56
57#[cfg(test)]
58mod tests {
59 use super::*;
60
61 #[test]
62 fn test_protocol_display() {
63 assert_eq!(Protocol::Http.to_string(), "http");
64 assert_eq!(Protocol::Grpc.to_string(), "grpc");
65 assert_eq!(Protocol::WebSocket.to_string(), "websocket");
66 assert_eq!(Protocol::GraphQL.to_string(), "graphql");
67 }
68}