Crate buswatch_adapters

Crate buswatch_adapters 

Source
Expand description

§buswatch-adapters

Pre-built adapters for collecting metrics from popular message bus systems.

This crate provides ready-to-use collectors that automatically gather metrics from message buses and convert them to buswatch format.

§Supported Systems

  • RabbitMQ (rabbitmq feature) - Collects queue depths, consumer counts, and message rates via the RabbitMQ Management API
  • Kafka (kafka feature) - Collects consumer group lag and partition metrics
  • NATS (nats feature) - Collects JetStream consumer and stream metrics

§Quick Start (RabbitMQ)

use buswatch_adapters::rabbitmq::RabbitMqAdapter;
use std::time::Duration;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let adapter = RabbitMqAdapter::builder()
        .endpoint("http://localhost:15672")
        .credentials("guest", "guest")
        .build();

    // Collect a snapshot
    let snapshot = adapter.collect().await?;

    println!("Collected {} modules", snapshot.modules.len());
    Ok(())
}

Re-exports§

pub use error::AdapterError;

Modules§

error
Error types for adapters.

Structs§

ModuleMetrics
Metrics for a single module/consumer/producer in the message bus.
ReadMetrics
Metrics for reading from a topic (subscription/consumer).
Snapshot
A point-in-time snapshot of message bus metrics.
WriteMetrics
Metrics for writing to a topic (publication/producer).