rabbitmq-backup-core 0.1.0

Core engine for RabbitMQ backup and restore operations
Documentation
//! Prometheus metric label types.

use prometheus_client::encoding::{EncodeLabelSet, EncodeLabelValue};

/// Labels for per-queue backup/restore metrics.
#[derive(Clone, Debug, Hash, PartialEq, Eq, EncodeLabelSet)]
pub struct QueueLabels {
    pub queue: String,
    pub vhost: String,
    pub queue_type: String,
}

/// Labels for error counter metrics.
#[derive(Clone, Debug, Hash, PartialEq, Eq, EncodeLabelSet)]
pub struct ErrorLabels {
    pub queue: String,
    pub vhost: String,
    pub error_type: String,
}

/// Error type classification for metrics.
#[derive(Clone, Debug, Hash, PartialEq, Eq, EncodeLabelValue)]
pub enum ErrorType {
    Amqp,
    Stream,
    Storage,
    Serialization,
    Connection,
    Authentication,
}

impl std::fmt::Display for ErrorType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Self::Amqp => write!(f, "amqp"),
            Self::Stream => write!(f, "stream"),
            Self::Storage => write!(f, "storage"),
            Self::Serialization => write!(f, "serialization"),
            Self::Connection => write!(f, "connection"),
            Self::Authentication => write!(f, "authentication"),
        }
    }
}