buswatch_adapters/lib.rs
1//! # buswatch-adapters
2//!
3//! Pre-built adapters for collecting metrics from popular message bus systems.
4//!
5//! This crate provides ready-to-use collectors that automatically gather
6//! metrics from message buses and convert them to buswatch format.
7//!
8//! ## Supported Systems
9//!
10//! - **RabbitMQ** (`rabbitmq` feature) - Collects queue depths, consumer counts,
11//! and message rates via the RabbitMQ Management API
12//! - **Kafka** (`kafka` feature) - Collects consumer group lag and partition metrics
13//! - **NATS** (`nats` feature) - Collects JetStream consumer and stream metrics
14//!
15//! ## Quick Start (RabbitMQ)
16//!
17//! ```rust,ignore
18//! use buswatch_adapters::rabbitmq::RabbitMqAdapter;
19//! use std::time::Duration;
20//!
21//! #[tokio::main]
22//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
23//! let adapter = RabbitMqAdapter::builder()
24//! .endpoint("http://localhost:15672")
25//! .credentials("guest", "guest")
26//! .build();
27//!
28//! // Collect a snapshot
29//! let snapshot = adapter.collect().await?;
30//!
31//! println!("Collected {} modules", snapshot.modules.len());
32//! Ok(())
33//! }
34//! ```
35
36pub mod error;
37
38#[cfg(feature = "rabbitmq")]
39pub mod rabbitmq;
40
41#[cfg(feature = "kafka")]
42pub mod kafka;
43
44#[cfg(feature = "nats")]
45pub mod nats;
46
47pub use error::AdapterError;
48
49// Re-export types for convenience
50pub use buswatch_types::{ModuleMetrics, ReadMetrics, Snapshot, WriteMetrics};